This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: An article I alluded to


Jeffrey Law <law@redhat.com> writes:
>> As this screws up gcc's optimization big time, I actually wrote a gcc
>> patch at one time that detected such "artifically static" variables and
>> changed them into normal automatic variables (at the time I was
>> comparing EEMBC results for gcc versus Greenhill's compiler -- the
>> latter already dealt with such artifically static variables, though as I
>> recall, it did so in an unsafe manner).
>
> "promoting" statics to autos certainly can be done by the compiler if
> you're willing to do use & escape analysis.  Nontrivial, but possible.

The patch I wrote (if I recall correctly; it's been a long time) waited
until after flow analysis had been done, and changed the variables to
auto if no variable-use reached the beginning of the function (and also,
I guess, their address hadn't been taken).

This didn't work perfectly -- some early optimizations get lost because
of the delayed conversion -- but it was fairly effective at sanitizing
all those quirky EEMBC benchmarks, and it was easy to implement.

-Miles
-- 
Run away!  Run away!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]