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]

[tree-ssa] Minor infrastructure change


I want to be able to use remove_decl to help remove variables in
remove_useless_stmts_and_vars.  However, as written remove_decl
is too heavyweight.

Specifically we already know what block the decl is declared in, so
there's little use in walking down the entire block tree to find
the requested variable.


	* tree-dfa.c (remove_decl): Accept new argument for the block
	to start the search.
	* tree-flow.h (remove_decl): Update prototype.
	* tree-cfg.c (remove_stmt): Pass the toplevel block to 
	remove_decl.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.84
diff -c -3 -p -r1.1.4.84 tree-cfg.c
*** tree-cfg.c	8 May 2003 03:26:49 -0000	1.1.4.84
--- tree-cfg.c	8 May 2003 18:50:02 -0000
*************** remove_stmt (stmt_p)
*** 1819,1825 ****
    /* If the statement is a LABEL_EXPR, remove the LABEL_DECL from
       the symbol table.  */
    if (TREE_CODE (stmt) == LABEL_EXPR)
!     remove_decl (LABEL_EXPR_LABEL (stmt));
  
    /* If the statement is already in SSA form, mark all the definitions made 
in
       the statement invalid.
--- 1819,1825 ----
    /* If the statement is a LABEL_EXPR, remove the LABEL_DECL from
       the symbol table.  */
    if (TREE_CODE (stmt) == LABEL_EXPR)
!     remove_decl (LABEL_EXPR_LABEL (stmt), DECL_INITIAL 
(current_function_decl));
  
    /* If the statement is already in SSA form, mark all the definitions made 
in
       the statement invalid.
Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.109
diff -c -3 -p -r1.1.4.109 tree-dfa.c
*** tree-dfa.c	8 May 2003 15:09:02 -0000	1.1.4.109
--- tree-dfa.c	8 May 2003 18:50:09 -0000
*************** may_access_global_mem_p (expr, expr_base
*** 2194,2205 ****
  /* Remove variable DECL from the block that declares it.  */
  
  void
! remove_decl (decl)
       tree decl;
  {
    tree *loc;
    
!   loc = find_decl_location (decl, DECL_INITIAL (current_function_decl));
    if (loc)
      *loc = TREE_CHAIN (decl);
  }
--- 2194,2206 ----
  /* Remove variable DECL from the block that declares it.  */
  
  void
! remove_decl (decl, block)
       tree decl;
+      tree block;
  {
    tree *loc;
    
!   loc = find_decl_location (decl, block);
    if (loc)
      *loc = TREE_CHAIN (decl);
  }
Index: tree-flow.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-flow.h,v
retrieving revision 1.1.4.75
diff -c -3 -p -r1.1.4.75 tree-flow.h
*** tree-flow.h	6 May 2003 15:31:41 -0000	1.1.4.75
--- tree-flow.h	8 May 2003 18:50:11 -0000
*************** extern void dump_immediate_uses		PARAMS 
*** 430,436 ****
  extern void debug_immediate_uses	PARAMS ((void));
  extern void dump_immediate_uses_for	PARAMS ((FILE *, tree));
  extern void debug_immediate_uses_for	PARAMS ((tree));
! extern void remove_decl			PARAMS ((tree));
  extern tree *find_decl_location		PARAMS ((tree, tree));
  extern void compute_may_aliases		PARAMS ((tree));
  extern void compute_reached_uses	PARAMS ((int));
--- 430,436 ----
  extern void debug_immediate_uses	PARAMS ((void));
  extern void dump_immediate_uses_for	PARAMS ((FILE *, tree));
  extern void debug_immediate_uses_for	PARAMS ((tree));
! extern void remove_decl			PARAMS ((tree, tree));
  extern tree *find_decl_location		PARAMS ((tree, tree));
  extern void compute_may_aliases		PARAMS ((tree));
  extern void compute_reached_uses	PARAMS ((int));






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