[tree-ssa]: SSAPRE Update

Daniel Berlin dberlin@dberlin.org
Wed Nov 6 08:25:00 GMT 2002


Starting to cleanup and remove unnecessary redundancy, structures, 
ugliness, and speeding up pieces of code that are slow.
Large portions of insertion code may look very ugly right now due to 
being in flux (It's waiting for DFA updates. I can't write code to 
update the SSA until we know the interface, which is still being 
decided).

I'll clean up and commonize the strength reduction bits next.

This update includes basic load PRE (aka register promotion) for 
indirect loads.
I'll do component refs, direct loads, and array loads after more clean 
up.
But
int main(int argc)
{
         static int a;
         static int *b;
         static int *d;
         static int c;
         a = 5;
         b = &a;
         d = &a;
         c = *b;
         c = *b;
         if (argc)
         {
                 *b = 5;
         }
         c = *b;

Will be optimized to:

main()
{
   int pretmp.1;
   static int a;
   static int * b;
   static int * d;
   static int c;

   a = 5;
   b = &a;
   d = &a;
   pretmp.1 = *b;
   c = pretmp.1;
   c = pretmp.1;
   if (argc != 0)
     {
       {
         pretmp.1 = 5;
         *b = pretmp.1
       }
     };
   c = pretmp.1
}
I'll wait a few hours before committing, on the off chance Diego is 
really against making set_bb_for_stmt external.

Diego, I externalized set_bb_for_stmt because it's one of the only 
functions we don't have a "get" but not a "set" accessible for (ie 
bb_for_stmt was around, but not set_bb_for_stmt) and it was necessary 
for proper operation.
Alternatively, you could make both bb_for_stmt and set_bb_for_stmt 
private, and have replace_ref_* call set_bb_for_stmt for us.
I only did it this way because I didn't want to interfere with any ref 
updating work you've done.

2002-11-04  Daniel Berlin  <dberlin@dberlin.org>

	* tree-flow.h: Prototype set_bb_for_stmt, last_stmt_ptr,
	add_ephi_arg, num_ephi_args, set_ephi_arg, ephi_arg.
	(enum tree_ref_type): Add E_LEFT, E_KILL, E_EXIT.

	* tree-cfg.c (set_bb_for_stmt): Move to tree-flow-inline.h.
	(last_stmt_ptr): New function, gives pointer to last statement in
	bb.

	* tree-flow-inline.h: Add exprref_processed, exprref_processed2,
	expruse_phi, num_ephi_args, set_ephi_arg, ephi_arg, add_ephi_arg.
	
	* tree-dfa.c (tree_ref_structure): Handle E_{LEFT,KILL,EXIT}.
	(ref_type_name): Ditto.
	(tree_ref_size): Ditto.
	(dump_ref): E_PHI's phi_args is now a varray of phi_arg structs.
	(add_ephi_arg): New function.
	(remove_ref_list): Fix crash when node not found.
	(compute_may_aliases): Add timing for points-to analysis.

	* timevar.def: Add TV_TREE_PTA.

	* tree-ssa-pre.c: Start of massive cleanup and rewriting (in
	preparation for load/store PRE). No more uses of ref_expr, proper
	call handling. Started removing unnecessary structures and lists,
	started removing redundant and inefficient operations (IE O(n^2)
	loops to process all phi operands, etc).  Basic load PRE implemented.
	Code may look ugly due to large pieces commented out waiting for DFA
	updating of refs to redo.
	
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prediff
Type: application/octet-stream
Size: 134710 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20021106/2fafee9e/attachment.obj>


More information about the Gcc-patches mailing list