From 6a60368a1b674083f27f0bdfacf85c2dbe4c0218 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Sun, 23 Dec 2012 21:39:04 +0100 Subject: [PATCH] -Olocaltemps -> -Olocal-temps for consistency; added manpage entry; removed leftover manpage entry for -foverlap-locals; -Olocal-temps moved from -O1 to -O3 due to stability concerns --- doc/gmqcc.1 | 12 ++++++++---- ir.c | 2 +- opts.def | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/gmqcc.1 b/doc/gmqcc.1 index 38b6fe1..474ec51 100644 --- a/doc/gmqcc.1 +++ b/doc/gmqcc.1 @@ -244,10 +244,6 @@ token inside the enclosing attribute-brackets. This may change when the actual attribute syntax is better defined. .SH COMPILE FLAGS .TP -.B -foverlap-locals -Allow local variables to overlap with each other if they don't -interfer with each other. (Not implemented right now) -.TP .B -fdarkplaces-string-table-bug Add some additional characters to the string table in order to compensate for a wrong boundcheck in some specific version of the @@ -358,6 +354,14 @@ as long as the functions cannot be called in a recursive manner. Since it's hard to know whether or not an array is actually fully initialized, especially when initializing it via a loop, we assume functions with arrays to be too dangerous for this optimization. +.TP +.B -Olocal-temps +This promotes locally declared variables to "temps". Meaning when a +temporary result of an operation has to be stored somewhere, a local +variable which is not 'alive' at that point can be used to keep the +result. This can reduce the size of the global section. +This will not have declared variables overlap, even if it was +possible. .SH CONFIG The configuration file is similar to regular .ini files. Comments start with hashtags or semicolons, sections are written in square diff --git a/ir.c b/ir.c index caf8438..ce98e6c 100644 --- a/ir.c +++ b/ir.c @@ -2127,7 +2127,7 @@ bool ir_function_allocate_locals(ir_function *self) for (i = 0; i < vec_size(self->locals); ++i) { - if (!OPTS_OPTIMIZATION(OPTIM_LOCALTEMPS)) + if (!OPTS_OPTIMIZATION(OPTIM_LOCAL_TEMPS)) self->locals[i]->unique_life = true; if (!function_allocator_alloc(&alloc, self->locals[i])) goto error; diff --git a/opts.def b/opts.def index c153240..e8d41cb 100644 --- a/opts.def +++ b/opts.def @@ -79,7 +79,7 @@ #ifdef GMQCC_TYPE_OPTIMIZATIONS GMQCC_DEFINE_FLAG(PEEPHOLE, 1) - GMQCC_DEFINE_FLAG(LOCALTEMPS, 1) + GMQCC_DEFINE_FLAG(LOCAL_TEMPS, 3) GMQCC_DEFINE_FLAG(TAIL_RECURSION, 1) GMQCC_DEFINE_FLAG(TAIL_CALLS, 2) GMQCC_DEFINE_FLAG(OVERLAP_LOCALS, 3) -- 2.39.2