OrangeC icon indicating copy to clipboard operation
OrangeC copied to clipboard

Use less temp variables

Open LADSoft opened this issue 3 years ago • 1 comments

if you do something like this:

#define MYCODE \
{ \
    /* declare some vars */ \
   /* do something slightly complicated, maybe a loop or maybe function calls */ \  
}
main()
{
    MYCODE;
    MYCODE;
    MYCODE;
     /* lots more */
    MYCODE;
}

you can overwhelm the temporary variable generator. Even if you don't go past the limit, optimization will be very slow. A fix for this might be to recognize that temporary variables go out of scope at the end of the block, and reuse them...

LADSoft avatar Aug 05 '22 21:08 LADSoft

the recent rewrites helped with this a bit; less indirections are generated which means less temp variables. Could still use a more formal look though.

LADSoft avatar Jun 26 '23 18:06 LADSoft