[tree-ssa-branch]: Convert ref arrays to lists

Daniel Berlin dberlin@dberlin.org
Tue Jul 9 14:05:00 GMT 2002


On Tuesday, July 9, 2002, at 04:39  PM, Diego Novillo wrote:

> On Mon, 08 Jul 2002, Daniel Berlin wrote:
>
>>
>>
>> Everything but phi chains are converted, because phi chains are a bit
>> special (we need to make sure the order matches the order in the bb
>> array).
>> This, of course, meant adding debug/dump_varref_array, and using
>> it just for phi chains.
>>
>>
>> Bootstrapped on i686-pc-linux-gnu.
>> I also verified the ssa dumps are exactly the same before and after on
>> real programs.
>>
>>
>> FOR_REF_BETWEEN looks ugly, but it's the only way i could think of to
>> simulate the semantics of
>>
>> nrefs = refs ? VARRAY_ACTIVE_SIZE (refs) : 0
>> for (i = 0; i < nrefs; i++)
>> {
>> 	ref = VARRAY_GENERIC_PTR (refs, i);
>>
>>
>> The reason FOR_EACH_REF[_REV] take a tmp argument is in case you want 
>> to
>> modify the node itself during traversal (IE replace the ref in it or
>> whatever), and to avoid conflicts in temp variable names with nested
>> FOR_EACH_REF loops.
>>
> Hmm, OK.  Not pretty, but I see your point.  We can always change
> this later.

Yeah. I kept looking for a way to make it less ugly.
It just didn't sit right with me.
It *looks* fragile, too.
But i couldn't figure out a way to do it.

>
> I made a few changes to your patch.  Mostly whitespace and
> comments.  Although it also had what seemed to be remnants of
> other patches.  I removed these hunks:
>
Whoops, should have looked closer.

>> Index: tree-inline.c
>> ===================================================================
>> RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
>> retrieving revision 1.26.2.1
>> diff -u -3 -p -w -B -b -r1.26.2.1 tree-inline.c
>> --- tree-inline.c	22 Jun 2002 04:39:43 -0000	1.26.2.1
>> +++ tree-inline.c	8 Jul 2002 16:24:03 -0000
>> @@ -46,7 +46,7 @@ Boston, MA 02111-1307, USA.  */
>>     candidates.  */
>>
>>  int flag_inline_trees = 0;
>> -
>> +static int inline_label_num = 0;
>>  /* To Do:
>>
>>     o In order to make inlining-on-trees work, we pessimized
>> @@ -789,6 +789,7 @@ expand_call_inline (tp, walk_subtrees, d
>>    tree use_stmt;
>>    tree arg_inits;
>>    tree *inlined_body;
>> +  char *label_name;
>>    splay_tree st;
>>
>>    /* See what we've got.  */
>> @@ -913,7 +914,8 @@ expand_call_inline (tp, walk_subtrees, d
>>
>>    /* Return statements in the function body will be replaced by jumps
>>       to the RET_LABEL.  */
>> -  id->ret_label = build_decl (LABEL_DECL, NULL_TREE, NULL_TREE);
>> +  ASM_FORMAT_PRIVATE_NAME (label_name, "inline", inline_label_num++);
>> +  id->ret_label = build_decl (LABEL_DECL, get_identifier 
>> (label_name), void_type_node);
>>    DECL_CONTEXT (id->ret_label) = VARRAY_TREE (id->fns, 0);
>>
>>    if (! DECL_INITIAL (fn)
>>
> I don't know what these changes are for.

Whoops, that was a "i'm tired of seeing unnamed labels for inline 
functions, so let's give them a name".
IE rather than see

<unnamed label>:
return value of inline function

you see

inline.<whatever>:
return value of inline function


IE no relevance whatsoever to this patch

>
>> Index: tree-optimize.c
>> ===================================================================
>> RCS file: /cvs/gcc/gcc/gcc/Attic/tree-optimize.c,v
>> retrieving revision 1.1.4.1
>> diff -u -3 -p -w -B -b -r1.1.4.1 tree-optimize.c
>> --- tree-optimize.c	22 Jun 2002 04:39:43 -0000	1.1.4.1
>> +++ tree-optimize.c	8 Jul 2002 16:24:03 -0000
>> @@ -89,6 +91,8 @@ build_tree_ssa (fndecl)
>>        tree_build_ssa ();
>>        tree_compute_rdefs ();
>>      }
>> +  if (flag_tree_points_to)
>> +    create_alias_vars ();
>>  }
>>
> This is part of the alias analysis patch that we still haven't
> added to the branch.
Yup.

>
>> @@ -97,7 +101,7 @@ build_tree_ssa (fndecl)
>>  static void
>>  init_tree_flow ()
>>  {
>> -  VARRAY_TREE_INIT (referenced_symbols, 20, "referenced_symbols");
>> +  VARRAY_GENERIC_PTR_INIT (referenced_symbols, 20, "Referenced 
>> symbols");
>>
> referenced_symbols is an array of trees.
>
I had accidently removed it when ref_listing everything (i first 
thought it was an array of refs), then added it back.
Of course, i added it back wrong.
:)

>> Index: tree-simple.h
>> ===================================================================
>> RCS file: /cvs/gcc/gcc/gcc/Attic/tree-simple.h,v
>> retrieving revision 1.1.4.2
>> diff -u -3 -p -w -B -b -r1.1.4.2 tree-simple.h
>> --- tree-simple.h	29 Jun 2002 18:08:04 -0000	1.1.4.2
>> +++ tree-simple.h	8 Jul 2002 16:24:03 -0000
>> @@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA.  */
>>  extern void insert_before_continue_end PARAMS ((tree, tree));
>>  extern void tree_build_scope           PARAMS ((tree *));
>>  extern tree create_tmp_var             PARAMS ((tree, const char *));
>> +extern tree create_tmp_alias_var             PARAMS ((tree, const 
>> char *));
>>  extern bool is_simple_tmp_var	       PARAMS ((tree));
>>  extern tree get_initialized_tmp_var    PARAMS ((tree, tree *));
>>  extern tree declare_tmp_vars           PARAMS ((tree, tree));
>>
> Another remnant from the alias analysis patch.
>
> This is what I will be committing to the branch:

Thanks, i'll make sure i look closer for unrelated changes next time.



More information about the Gcc-patches mailing list