[PATCH] (4/7) Promote statics to automatics

Daniel Berlin dberlin@dberlin.org
Wed Jun 8 18:43:00 GMT 2005


This accidently went only to Kenny the first time.

This is patch 4/7 of the IPA stuff we've been working on.
This promotes statics to automatics when possible and profitable,
allowing us to do SSA optimizations from them.

I have a very trivial pass coming that post-eliminates the useless
static store/loads before someone asks, which are of the form.

<something> = <static var>
<something2> = <any number of copies between variables from something,
but no other uses>
<static var> = <something>


Store-ccp/copy prop won't touch these because copy/constant propping
would generally introduce *more* memory loads, not less.  Diego agreed
it should just be a simple pattern matcher to eliminate them.

In this case, it will eliminate the store, and DCE will then eliminate
the rest.

Bootstrapped and regtested on i686-pc-linux-gnu.

Okay for mainline?
2005-06-06  Kenneth Zadeck  <zadeck@naturalbridge.com>
       Danny Berlin <dberlin@dberlin.org>

      Promotion of static variables to registers.
   * tree-promote-statics.c: new file.
   * tree-optimize.c (init_tree_optimization_passes): Added pass.
   * tree-flow.h: Added exposed sra calls.
   * tree-optimize.c: Added pass.
   * tree-pass.h: Added pass.
   * tree-sra.c: (type_can_be_decomposed_p): renamed from
   type_can_be_decomposed_p and made public
   (sra_insert_before, sra_insert_after) Made public.
   (sra_init_cache): New function.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: promote-statics.diff
Type: text/x-patch
Size: 5791 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050608/e4d362f2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tree-promote-statics.c
Type: text/x-csrc
Size: 17420 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050608/e4d362f2/attachment-0001.bin>


More information about the Gcc-patches mailing list