This is the mail archive of the gcc-patches@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: [tree-ssa] BIND_EXPR removal


Hello,

> On Sun, Nov 02, 2003 at 12:29:12PM +0100, Zdenek Dvorak wrote:
> > OK, the second attempt.  It just records the variables in the gimple
> > lowering phase, then expands those of them that were not optimized
> > out afterwards (the code to determine this is taken from
> > remove_unused_... in tree-cfg.c, so it should do exactly what we do now).
> 
> This seems ok for now.

:-( just after commiting it I run into a problem that did not show up in
any of the previous tests.  The list of unexpanded variables of course
cannot be global, since it may contain declarations of local functions
that would rewrite it when expanded.

Zdenek

	* function.h (struct function): New field unexpanded_var_list.
	* gimple-low.c (unexpanded_var_list): Removed.
	(record_vars, expand_used_vars): Use cfun->unexpanded_var_list.
	* tree-flow.h (unexpanded_var_list): Declaration removed.

Index: function.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.h,v
retrieving revision 1.83.2.16
diff -c -3 -p -r1.83.2.16 function.h
*** function.h	26 Oct 2003 18:16:54 -0000	1.83.2.16
--- function.h	3 Nov 2003 20:32:18 -0000
*************** struct function GTY(())
*** 419,424 ****
--- 419,427 ----
    /* Array mapping insn uids to blocks.  */
    struct varray_head_tag *ib_boundaries_block;
  
+   /* The variables unexpanded so far.  */
+   tree unexpanded_var_list;
+ 
    /* Collected bit flags.  */
  
    /* Nonzero if function being compiled needs to be given an address
Index: gimple-low.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/gimple-low.c,v
retrieving revision 1.1.4.4
diff -c -3 -p -r1.1.4.4 gimple-low.c
*** gimple-low.c	3 Nov 2003 13:12:34 -0000	1.1.4.4
--- gimple-low.c	3 Nov 2003 20:32:18 -0000
*************** static void lower_cond_expr (tree_stmt_i
*** 54,61 ****
  static bool simple_goto_p (tree);
  static void record_vars (tree);
  
- tree unexpanded_var_list;
- 
  /* Lowers the BODY.  */
  void
  lower_function_body (tree *body)
--- 54,59 ----
*************** record_vars (tree vars)
*** 150,156 ****
  	continue;
  
        /* Record the variable.  */
!       unexpanded_var_list = tree_cons (NULL_TREE, var, unexpanded_var_list);
      }
  }
  
--- 148,155 ----
  	continue;
  
        /* Record the variable.  */
!       cfun->unexpanded_var_list = tree_cons (NULL_TREE, var,
! 					     cfun->unexpanded_var_list);
      }
  }
  
*************** expand_used_vars (void)
*** 276,284 ****
  {
    tree var, cell;
  
!   unexpanded_var_list = nreverse (unexpanded_var_list);
  
!   for (cell = unexpanded_var_list; cell; cell = TREE_CHAIN (cell))
      {
        var = TREE_VALUE (cell);
  
--- 275,283 ----
  {
    tree var, cell;
  
!   cfun->unexpanded_var_list = nreverse (cfun->unexpanded_var_list);
  
!   for (cell = cfun->unexpanded_var_list; cell; cell = TREE_CHAIN (cell))
      {
        var = TREE_VALUE (cell);
  
*************** expand_used_vars (void)
*** 302,306 ****
        expand_var (var);
      }
  
!   unexpanded_var_list = NULL_TREE;
  }
--- 301,305 ----
        expand_var (var);
      }
  
!   cfun->unexpanded_var_list = NULL_TREE;
  }
Index: tree-flow.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-flow.h,v
retrieving revision 1.1.4.138
diff -c -3 -p -r1.1.4.138 tree-flow.h
*** tree-flow.h	3 Nov 2003 17:47:35 -0000	1.1.4.138
--- tree-flow.h	3 Nov 2003 20:32:18 -0000
*************** extern GTY(()) tree global_var;
*** 378,386 ****
  /* Array of all variables that are call clobbered in the function.  */
  extern GTY(()) varray_type call_clobbered_vars;
  
- /* List of the variables found during gimple lowering pass.  */
- extern GTY(()) tree unexpanded_var_list;
- 
  #define num_call_clobbered_vars	VARRAY_ACTIVE_SIZE (call_clobbered_vars)
  #define add_call_clobbered_var(v) VARRAY_PUSH_TREE (call_clobbered_vars, v)
  #define call_clobbered_var(i) VARRAY_TREE (call_clobbered_vars, i)
--- 378,383 ----


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