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]

[patch] Move some prototypes out of tree-flow.h


This patch moves 5 sets of prototypes out of tree-flow.h and creates 4 new header files.

I then #include the new header files from tree-flow.h as a temporary measure until all prototypes have been cleared up. then as previously discussed, I will revisit all the #includes *of* and *within* tree-flow.h to get it and the .c files down to the basics required. I suspect this will then expose more functions that should be shuffled. This time around I'm only shuffled what really needed shuffling for compilation.

all files now list all the exports within a file.

tree-cfgcleanup.h: new file. pretty basic.. just moved the prototypes.

tree-dfa.h: new file. Add the prototypes, and moved get_addr_base_and_unit_offset_1 from tree-flow-inline.h. its related funcitons were in tree-dfa.c so I just left them all there for now.

tree-pretty-print.h: This file already existed, but some of the prototypes were in tree-flow.h for some reason. It also contained a prototype for a c front end debug routine which isn't used anywhere, so I deleted that.

tree-into-ssa.h: Another new file, moved the prototypes out of tree-flow and there were bunch of debug prototypes ni the .c file itself. I moved those to the header file for clarity.

gimple-low.h: The final new file. Moved the prototypes here.

gImple-low.c: I moved try_catch_may_fallthru() and block_may_fallthru() to tree.c... there are gimple versions in gimple-low.c already, and it turns out that block_may_fallthru() is called from the c++ front end.. so it doesn't belong in gimple.c. The prototype is already in tree.h anyway.

a few .c files required adding tree.h to the include file to pick up bits that moved due to the reshuffling. mostly uses of enum tree_code in tree-pretty-print.h. eventually, all the .c files ought to include tree.h directly. I'll tak care of that to some degree when tree-flow.h is finally sorted out.

Bootstraps on x86_64-unknown-linux-gnu and no new regressions.  OK?

Andrew
	* tree-flow.h: Include new .h files.  Move prototypes.
	* tree-cfgcleanup.h: New file.  Add prototypes from tree-flow.h.
	* tree-dfa.h: New File.  Add prototypes from tree-flow.h.
	(get_addr_base_and_unit_offset_1) Move from tree-flow-inline.h.
	* tree-pretty-print.h: Add prototypes from tree-flow.h.
	* tree-into-ssa.h: New File.  Add prototypes from tree-flow.h.
	({debug|dump}*): Move debugging prototypes out of tree-into-ssa.c.
	* tree-into-ssa.c ({debug|dump}*): Move prototypes to header file.
	* tree.h (get_ref_base_and_extent): Move prototype out.
	* tree-flow-inline.h (get_addr_base_and_unit_offset_1): Move to 
	tree-dfa.h.
	* gimple-low.h: New File.  Add prototypes from tree-flow.h.
	* gimple-low.c (try_catch_may_fallthru, block_may_fallthru): Move to...
	* tree.c (try_catch_may_fallthru, block_may_fallthru): Here.
	* tree-scalar-evolution.c: Include tree.h.
	* sese.c: Include tree.h.
	* dumpfile.c: Move gimple-pretty-print.h include after tree.h.
	* dwarf2out.c: Include tree-dfa.h.
	* tree-chrec.c: Include tree.h.
	* tree-data-ref.c: Include tree.h.

Index: tree-flow.h
===================================================================
*** tree-flow.h	(revision 203034)
--- tree-flow.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 30,36 ****
  #include "cgraph.h"
  #include "ipa-reference.h"
  #include "tree-ssa-alias.h"
! 
  
  /* This structure is used to map a gimple statement to a label,
     or list of labels to represent transaction restart.  */
--- 30,40 ----
  #include "cgraph.h"
  #include "ipa-reference.h"
  #include "tree-ssa-alias.h"
! #include "tree-cfgcleanup.h"
! #include "tree-dfa.h"
! #include "tree-pretty-print.h"
! #include "gimple-low.h"
! #include "tree-into-ssa.h"
  
  /* This structure is used to map a gimple statement to a label,
     or list of labels to represent transaction restart.  */
--- 96,101 ----
*************** extern basic_block move_sese_region_to_f
*** 379,408 ****
  void remove_edge_and_dominated_blocks (edge);
  bool tree_node_can_be_shared (tree);
  
- /* In tree-cfgcleanup.c  */
- extern bitmap cfgcleanup_altered_bbs;
- extern bool cleanup_tree_cfg (void);
- 
- /* In tree-pretty-print.c.  */
- extern void dump_generic_bb (FILE *, basic_block, int, int);
- extern int op_code_prio (enum tree_code);
- extern int op_prio (const_tree);
- extern const char *op_symbol_code (enum tree_code);
- 
- /* In tree-dfa.c  */
- extern void renumber_gimple_stmt_uids (void);
- extern void renumber_gimple_stmt_uids_in_blocks (basic_block *, int);
- extern void dump_dfa_stats (FILE *);
- extern void debug_dfa_stats (void);
- extern void dump_variable (FILE *, tree);
- extern void debug_variable (tree);
- extern void set_ssa_default_def (struct function *, tree, tree);
- extern tree ssa_default_def (struct function *, tree);
- extern tree get_or_create_ssa_default_def (struct function *, tree);
- extern bool stmt_references_abnormal_ssa_name (gimple);
- extern tree get_addr_base_and_unit_offset (tree, HOST_WIDE_INT *);
- extern void dump_enumerated_decls (FILE *, int);
- 
  /* In tree-phinodes.c  */
  extern void reserve_phi_args_for_new_edge (basic_block);
  extern void add_phi_node_to_bb (gimple phi, basic_block bb);
--- 368,373 ----
*************** extern void remove_phi_nodes (basic_bloc
*** 414,437 ****
  extern void release_phi_node (gimple);
  extern void phinodes_print_statistics (void);
  
- /* In gimple-low.c  */
- extern void record_vars_into (tree, tree);
- extern void record_vars (tree);
- extern bool gimple_seq_may_fallthru (gimple_seq);
- extern bool gimple_stmt_may_fallthru (gimple);
- extern bool gimple_check_call_matching_types (gimple, tree, bool);
- 
- /* In tree-into-ssa.c  */
- void update_ssa (unsigned);
- void delete_update_ssa (void);
- tree create_new_def_for (tree, gimple, def_operand_p);
- bool need_ssa_update_p (struct function *);
- bool name_registered_for_update_p (tree);
- void release_ssa_name_after_update_ssa (tree);
- void mark_virtual_operands_for_renaming (struct function *);
- tree get_current_def (tree);
- void set_current_def (tree, tree);
- 
  /* In tree-ssa-ccp.c  */
  tree fold_const_aggregate_ref (tree);
  tree gimple_fold_stmt_to_constant (gimple, tree (*)(tree));
--- 379,384 ----
*************** void get_address_description (tree, stru
*** 674,680 ****
  tree maybe_fold_tmr (tree);
  
  unsigned int execute_fixup_cfg (void);
- bool fixup_noreturn_call (gimple stmt);
  
  /* In ipa-pure-const.c  */
  void warn_function_noreturn (tree);
--- 621,626 ----
Index: tree-cfgcleanup.h
===================================================================
*** tree-cfgcleanup.h	(revision 0)
--- tree-cfgcleanup.h	(working copy)
***************
*** 0 ****
--- 1,28 ----
+ /* Header file for CFG cleanup for trees.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_CFGCLEANUP_H
+ #define GCC_TREE_CFGCLEANUP_H
+ 
+ /* In tree-cfgcleanup.c  */
+ extern bitmap cfgcleanup_altered_bbs;
+ extern bool cleanup_tree_cfg (void);
+ extern bool fixup_noreturn_call (gimple stmt);
+ 
+ #endif /* GCC_TREE_CFGCLEANUP_H */
Index: tree-dfa.h
===================================================================
*** tree-dfa.h	(revision 0)
--- tree-dfa.h	(working copy)
***************
*** 0 ****
--- 1,184 ----
+ /* Header file for tree data flow functions.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_DFA_H
+ #define GCC_TREE_DFA_H
+ 
+ extern void renumber_gimple_stmt_uids (void);
+ extern void renumber_gimple_stmt_uids_in_blocks (basic_block *, int);
+ extern void dump_variable (FILE *, tree);
+ extern void debug_variable (tree);
+ extern void dump_dfa_stats (FILE *);
+ extern void debug_dfa_stats (void);
+ extern tree ssa_default_def (struct function *, tree);
+ extern void set_ssa_default_def (struct function *, tree, tree);
+ extern tree get_or_create_ssa_default_def (struct function *, tree);
+ extern tree get_ref_base_and_extent (tree, HOST_WIDE_INT *,
+ 				     HOST_WIDE_INT *, HOST_WIDE_INT *);
+ extern tree get_addr_base_and_unit_offset (tree, HOST_WIDE_INT *);
+ extern bool stmt_references_abnormal_ssa_name (gimple);
+ extern void dump_enumerated_decls (FILE *, int);
+ 
+ /* Returns the base object and a constant BITS_PER_UNIT offset in *POFFSET that
+    denotes the starting address of the memory access EXP.
+    Returns NULL_TREE if the offset is not constant or any component
+    is not BITS_PER_UNIT-aligned.
+    VALUEIZE if non-NULL is used to valueize SSA names.  It should return
+    its argument or a constant if the argument is known to be constant.  */
+ /* ??? This is a static inline here to avoid the overhead of the indirect calls
+    to VALUEIZE.  But is this overhead really that significant?  And should we
+    perhaps just rely on WHOPR to specialize the function?  */
+ 
+ static inline tree
+ get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset,
+ 				 tree (*valueize) (tree))
+ {
+   HOST_WIDE_INT byte_offset = 0;
+ 
+   /* Compute cumulative byte-offset for nested component-refs and array-refs,
+      and find the ultimate containing object.  */
+   while (1)
+     {
+       switch (TREE_CODE (exp))
+ 	{
+ 	case BIT_FIELD_REF:
+ 	  {
+ 	    HOST_WIDE_INT this_off = TREE_INT_CST_LOW (TREE_OPERAND (exp, 2));
+ 	    if (this_off % BITS_PER_UNIT)
+ 	      return NULL_TREE;
+ 	    byte_offset += this_off / BITS_PER_UNIT;
+ 	  }
+ 	  break;
+ 
+ 	case COMPONENT_REF:
+ 	  {
+ 	    tree field = TREE_OPERAND (exp, 1);
+ 	    tree this_offset = component_ref_field_offset (exp);
+ 	    HOST_WIDE_INT hthis_offset;
+ 
+ 	    if (!this_offset
+ 		|| TREE_CODE (this_offset) != INTEGER_CST
+ 		|| (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field))
+ 		    % BITS_PER_UNIT))
+ 	      return NULL_TREE;
+ 
+ 	    hthis_offset = TREE_INT_CST_LOW (this_offset);
+ 	    hthis_offset += (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field))
+ 			     / BITS_PER_UNIT);
+ 	    byte_offset += hthis_offset;
+ 	  }
+ 	  break;
+ 
+ 	case ARRAY_REF:
+ 	case ARRAY_RANGE_REF:
+ 	  {
+ 	    tree index = TREE_OPERAND (exp, 1);
+ 	    tree low_bound, unit_size;
+ 
+ 	    if (valueize
+ 		&& TREE_CODE (index) == SSA_NAME)
+ 	      index = (*valueize) (index);
+ 
+ 	    /* If the resulting bit-offset is constant, track it.  */
+ 	    if (TREE_CODE (index) == INTEGER_CST
+ 		&& (low_bound = array_ref_low_bound (exp),
+ 		    TREE_CODE (low_bound) == INTEGER_CST)
+ 		&& (unit_size = array_ref_element_size (exp),
+ 		    TREE_CODE (unit_size) == INTEGER_CST))
+ 	      {
+ 		HOST_WIDE_INT hindex = TREE_INT_CST_LOW (index);
+ 
+ 		hindex -= TREE_INT_CST_LOW (low_bound);
+ 		hindex *= TREE_INT_CST_LOW (unit_size);
+ 		byte_offset += hindex;
+ 	      }
+ 	    else
+ 	      return NULL_TREE;
+ 	  }
+ 	  break;
+ 
+ 	case REALPART_EXPR:
+ 	  break;
+ 
+ 	case IMAGPART_EXPR:
+ 	  byte_offset += TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (exp)));
+ 	  break;
+ 
+ 	case VIEW_CONVERT_EXPR:
+ 	  break;
+ 
+ 	case MEM_REF:
+ 	  {
+ 	    tree base = TREE_OPERAND (exp, 0);
+ 	    if (valueize
+ 		&& TREE_CODE (base) == SSA_NAME)
+ 	      base = (*valueize) (base);
+ 
+ 	    /* Hand back the decl for MEM[&decl, off].  */
+ 	    if (TREE_CODE (base) == ADDR_EXPR)
+ 	      {
+ 		if (!integer_zerop (TREE_OPERAND (exp, 1)))
+ 		  {
+ 		    double_int off = mem_ref_offset (exp);
+ 		    gcc_assert (off.high == -1 || off.high == 0);
+ 		    byte_offset += off.to_shwi ();
+ 		  }
+ 		exp = TREE_OPERAND (base, 0);
+ 	      }
+ 	    goto done;
+ 	  }
+ 
+ 	case TARGET_MEM_REF:
+ 	  {
+ 	    tree base = TREE_OPERAND (exp, 0);
+ 	    if (valueize
+ 		&& TREE_CODE (base) == SSA_NAME)
+ 	      base = (*valueize) (base);
+ 
+ 	    /* Hand back the decl for MEM[&decl, off].  */
+ 	    if (TREE_CODE (base) == ADDR_EXPR)
+ 	      {
+ 		if (TMR_INDEX (exp) || TMR_INDEX2 (exp))
+ 		  return NULL_TREE;
+ 		if (!integer_zerop (TMR_OFFSET (exp)))
+ 		  {
+ 		    double_int off = mem_ref_offset (exp);
+ 		    gcc_assert (off.high == -1 || off.high == 0);
+ 		    byte_offset += off.to_shwi ();
+ 		  }
+ 		exp = TREE_OPERAND (base, 0);
+ 	      }
+ 	    goto done;
+ 	  }
+ 
+ 	default:
+ 	  goto done;
+ 	}
+ 
+       exp = TREE_OPERAND (exp, 0);
+     }
+ done:
+ 
+   *poffset = byte_offset;
+   return exp;
+ }
+ 
+ 
+ 
+ #endif /* GCC_TREE_DFA_H */
Index: tree-pretty-print.h
===================================================================
*** tree-pretty-print.h	(revision 203034)
--- tree-pretty-print.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 31,54 ****
  
  #define pp_ti_abstract_origin(TI) ((tree *) (TI)->x_data)
  
- extern void pp_tree_identifier (pretty_printer *, tree);
  
! /* In tree-pretty-print.c  */
! extern void print_declaration (pretty_printer *, tree, int, int);
! extern int dump_generic_node (pretty_printer *, tree, int, int, bool);
  extern void print_generic_stmt (FILE *, tree, int);
  extern void print_generic_stmt_indented (FILE *, tree, int, int);
  extern void print_generic_expr (FILE *, tree, int);
- extern void print_generic_decl (FILE *, tree, int);
  extern void dump_omp_clauses (pretty_printer *, tree, int, int);
  extern void print_call_name (pretty_printer *, tree, int);
- extern void debug_generic_expr (tree);
- extern void debug_generic_stmt (tree);
- extern void debug_tree_chain (tree);
  extern void percent_K_format (text_info *);
  extern void dump_function_header (FILE *, tree, int);
  extern void pp_double_int (pretty_printer *pp, double_int d, bool uns);
- /* In c-pretty-print.c  */
- extern void debug_c_tree (tree);
  
  #endif /* ! GCC_TREE_PRETTY_PRINT_H */
--- 31,54 ----
  
  #define pp_ti_abstract_origin(TI) ((tree *) (TI)->x_data)
  
  
! extern void debug_generic_expr (tree);
! extern void debug_generic_stmt (tree);
! extern void debug_tree_chain (tree);
! extern void print_generic_decl (FILE *, tree, int);
  extern void print_generic_stmt (FILE *, tree, int);
  extern void print_generic_stmt_indented (FILE *, tree, int, int);
  extern void print_generic_expr (FILE *, tree, int);
  extern void dump_omp_clauses (pretty_printer *, tree, int, int);
+ extern int dump_generic_node (pretty_printer *, tree, int, int, bool);
+ extern void print_declaration (pretty_printer *, tree, int, int);
+ extern int op_code_prio (enum tree_code);
+ extern int op_prio (const_tree);
+ extern const char *op_symbol_code (enum tree_code);
  extern void print_call_name (pretty_printer *, tree, int);
  extern void percent_K_format (text_info *);
+ extern void pp_tree_identifier (pretty_printer *, tree);
  extern void dump_function_header (FILE *, tree, int);
  extern void pp_double_int (pretty_printer *pp, double_int d, bool uns);
  
  #endif /* ! GCC_TREE_PRETTY_PRINT_H */
Index: tree-into-ssa.h
===================================================================
*** tree-into-ssa.h	(revision 0)
--- tree-into-ssa.h	(working copy)
***************
*** 0 ****
--- 1,50 ----
+ /* Header file for normal form into SSA.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_TREE_INTO_SSA_H
+ #define GCC_TREE_INTO_SSA_H
+ 
+ extern tree get_current_def (tree);
+ extern void set_current_def (tree, tree);
+ void delete_update_ssa (void);
+ tree create_new_def_for (tree, gimple, def_operand_p);
+ void mark_virtual_operands_for_renaming (struct function *);
+ bool need_ssa_update_p (struct function *);
+ bool name_registered_for_update_p (tree);
+ void release_ssa_name_after_update_ssa (tree);
+ void update_ssa (unsigned);
+ 
+ /* Prototypes for debugging functions.  */
+ extern void debug_decl_set (bitmap set);
+ extern void dump_defs_stack (FILE *, int);
+ extern void debug_defs_stack (int);
+ extern void dump_currdefs (FILE *);
+ extern void debug_currdefs (void);
+ extern void dump_tree_ssa (FILE *);
+ extern void debug_tree_ssa (void);
+ extern void dump_tree_ssa_stats (FILE *);
+ extern void debug_tree_ssa_stats (void);
+ extern void dump_var_infos (FILE *);
+ extern void debug_var_infos (void);
+ extern void dump_names_replaced_by (FILE *, tree);
+ extern void debug_names_replaced_by (tree);
+ extern void dump_update_ssa (FILE *);
+ extern void debug_update_ssa (void);
+ 
+ #endif /* GCC_TREE_INTO_SSA_H */
Index: tree-into-ssa.c
===================================================================
*** tree-into-ssa.c	(revision 203034)
--- tree-into-ssa.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 39,44 ****
--- 39,45 ----
  #include "domwalk.h"
  #include "params.h"
  #include "diagnostic-core.h"
+ #include "tree-into-ssa.h"
  
  
  /* This file builds the SSA form for a function as described in:
*************** enum rewrite_mode {
*** 229,255 ****
      REWRITE_UPDATE
  };
  
- 
- 
- 
- /* Prototypes for debugging functions.  */
- extern void dump_tree_ssa (FILE *);
- extern void debug_tree_ssa (void);
- extern void debug_def_blocks (void);
- extern void dump_tree_ssa_stats (FILE *);
- extern void debug_tree_ssa_stats (void);
- extern void dump_update_ssa (FILE *);
- extern void debug_update_ssa (void);
- extern void dump_names_replaced_by (FILE *, tree);
- extern void debug_names_replaced_by (tree);
- extern void dump_var_infos (FILE *);
- extern void debug_var_infos (void);
- extern void dump_defs_stack (FILE *, int);
- extern void debug_defs_stack (int);
- extern void dump_currdefs (FILE *);
- extern void debug_currdefs (void);
- 
- 
  /* The set of symbols we ought to re-write into SSA form in update_ssa.  */
  static bitmap symbols_to_rename_set;
  static vec<tree> symbols_to_rename;
--- 230,235 ----
Index: tree.h
===================================================================
*** tree.h	(revision 203034)
--- tree.h	(working copy)
*************** extern tree get_binfo_at_offset (tree, H
*** 4528,4537 ****
  extern bool virtual_method_call_p (tree);
  extern tree obj_type_ref_class (tree ref);
  extern bool types_same_for_odr (tree type1, tree type2);
- extern tree get_ref_base_and_extent (tree, HOST_WIDE_INT *,
- 				     HOST_WIDE_INT *, HOST_WIDE_INT *);
  extern bool contains_bitfld_component_ref_p (const_tree);
  extern bool type_in_anonymous_namespace_p (tree);
  
  /* In tree-nested.c */
  extern tree build_addr (tree, tree);
--- 4528,4536 ----
  extern bool virtual_method_call_p (tree);
  extern tree obj_type_ref_class (tree ref);
  extern bool types_same_for_odr (tree type1, tree type2);
  extern bool contains_bitfld_component_ref_p (const_tree);
  extern bool type_in_anonymous_namespace_p (tree);
+ extern bool block_may_fallthru (const_tree);
  
  /* In tree-nested.c */
  extern tree build_addr (tree, tree);
*************** is_lang_specific (tree t)
*** 4880,4888 ****
    return TREE_CODE (t) == LANG_TYPE || TREE_CODE (t) >= NUM_TREE_CODES;
  }
  
- /* In gimple-low.c.  */
- extern bool block_may_fallthru (const_tree);
- 
  /* In vtable-verify.c.  */
  extern void save_vtable_map_decl (tree);
  
--- 4879,4884 ----
Index: tree-flow-inline.h
===================================================================
*** tree-flow-inline.h	(revision 203034)
--- tree-flow-inline.h	(working copy)
*************** gimple_ssa_operands (const struct functi
*** 1158,1306 ****
    return &fun->gimple_df->ssa_operands;
  }
  
- 
- /* Returns the base object and a constant BITS_PER_UNIT offset in *POFFSET that
-    denotes the starting address of the memory access EXP.
-    Returns NULL_TREE if the offset is not constant or any component
-    is not BITS_PER_UNIT-aligned.
-    VALUEIZE if non-NULL is used to valueize SSA names.  It should return
-    its argument or a constant if the argument is known to be constant.  */
- /* ??? This is a static inline here to avoid the overhead of the indirect calls
-    to VALUEIZE.  But is this overhead really that significant?  And should we
-    perhaps just rely on WHOPR to specialize the function?  */
- 
- static inline tree
- get_addr_base_and_unit_offset_1 (tree exp, HOST_WIDE_INT *poffset,
- 				 tree (*valueize) (tree))
- {
-   HOST_WIDE_INT byte_offset = 0;
- 
-   /* Compute cumulative byte-offset for nested component-refs and array-refs,
-      and find the ultimate containing object.  */
-   while (1)
-     {
-       switch (TREE_CODE (exp))
- 	{
- 	case BIT_FIELD_REF:
- 	  {
- 	    HOST_WIDE_INT this_off = TREE_INT_CST_LOW (TREE_OPERAND (exp, 2));
- 	    if (this_off % BITS_PER_UNIT)
- 	      return NULL_TREE;
- 	    byte_offset += this_off / BITS_PER_UNIT;
- 	  }
- 	  break;
- 
- 	case COMPONENT_REF:
- 	  {
- 	    tree field = TREE_OPERAND (exp, 1);
- 	    tree this_offset = component_ref_field_offset (exp);
- 	    HOST_WIDE_INT hthis_offset;
- 
- 	    if (!this_offset
- 		|| TREE_CODE (this_offset) != INTEGER_CST
- 		|| (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field))
- 		    % BITS_PER_UNIT))
- 	      return NULL_TREE;
- 
- 	    hthis_offset = TREE_INT_CST_LOW (this_offset);
- 	    hthis_offset += (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field))
- 			     / BITS_PER_UNIT);
- 	    byte_offset += hthis_offset;
- 	  }
- 	  break;
- 
- 	case ARRAY_REF:
- 	case ARRAY_RANGE_REF:
- 	  {
- 	    tree index = TREE_OPERAND (exp, 1);
- 	    tree low_bound, unit_size;
- 
- 	    if (valueize
- 		&& TREE_CODE (index) == SSA_NAME)
- 	      index = (*valueize) (index);
- 
- 	    /* If the resulting bit-offset is constant, track it.  */
- 	    if (TREE_CODE (index) == INTEGER_CST
- 		&& (low_bound = array_ref_low_bound (exp),
- 		    TREE_CODE (low_bound) == INTEGER_CST)
- 		&& (unit_size = array_ref_element_size (exp),
- 		    TREE_CODE (unit_size) == INTEGER_CST))
- 	      {
- 		HOST_WIDE_INT hindex = TREE_INT_CST_LOW (index);
- 
- 		hindex -= TREE_INT_CST_LOW (low_bound);
- 		hindex *= TREE_INT_CST_LOW (unit_size);
- 		byte_offset += hindex;
- 	      }
- 	    else
- 	      return NULL_TREE;
- 	  }
- 	  break;
- 
- 	case REALPART_EXPR:
- 	  break;
- 
- 	case IMAGPART_EXPR:
- 	  byte_offset += TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (exp)));
- 	  break;
- 
- 	case VIEW_CONVERT_EXPR:
- 	  break;
- 
- 	case MEM_REF:
- 	  {
- 	    tree base = TREE_OPERAND (exp, 0);
- 	    if (valueize
- 		&& TREE_CODE (base) == SSA_NAME)
- 	      base = (*valueize) (base);
- 
- 	    /* Hand back the decl for MEM[&decl, off].  */
- 	    if (TREE_CODE (base) == ADDR_EXPR)
- 	      {
- 		if (!integer_zerop (TREE_OPERAND (exp, 1)))
- 		  {
- 		    double_int off = mem_ref_offset (exp);
- 		    gcc_assert (off.high == -1 || off.high == 0);
- 		    byte_offset += off.to_shwi ();
- 		  }
- 		exp = TREE_OPERAND (base, 0);
- 	      }
- 	    goto done;
- 	  }
- 
- 	case TARGET_MEM_REF:
- 	  {
- 	    tree base = TREE_OPERAND (exp, 0);
- 	    if (valueize
- 		&& TREE_CODE (base) == SSA_NAME)
- 	      base = (*valueize) (base);
- 
- 	    /* Hand back the decl for MEM[&decl, off].  */
- 	    if (TREE_CODE (base) == ADDR_EXPR)
- 	      {
- 		if (TMR_INDEX (exp) || TMR_INDEX2 (exp))
- 		  return NULL_TREE;
- 		if (!integer_zerop (TMR_OFFSET (exp)))
- 		  {
- 		    double_int off = mem_ref_offset (exp);
- 		    gcc_assert (off.high == -1 || off.high == 0);
- 		    byte_offset += off.to_shwi ();
- 		  }
- 		exp = TREE_OPERAND (base, 0);
- 	      }
- 	    goto done;
- 	  }
- 
- 	default:
- 	  goto done;
- 	}
- 
-       exp = TREE_OPERAND (exp, 0);
-     }
- done:
- 
-   *poffset = byte_offset;
-   return exp;
- }
- 
  #endif /* _TREE_FLOW_INLINE_H  */
--- 1112,1115 ----
Index: gimple-low.h
===================================================================
*** gimple-low.h	(revision 0)
--- gimple-low.h	(working copy)
***************
*** 0 ****
--- 1,29 ----
+ /* Header file for gimple lowering pass.
+    Copyright (C) 2013 Free Software Foundation, Inc.
+ 
+ This file is part of GCC.
+ 
+ GCC is free software; you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free
+ Software Foundation; either version 3, or (at your option) any later
+ version.
+ 
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+  for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with GCC; see the file COPYING3.  If not see
+ <http://www.gnu.org/licenses/>.  */
+ 
+ #ifndef GCC_GIMPLE_LOW_H
+ #define GCC_GIMPLE_LOW_H
+ 
+ extern bool gimple_check_call_matching_types (gimple, tree, bool);
+ extern bool gimple_stmt_may_fallthru (gimple);
+ extern bool gimple_seq_may_fallthru (gimple_seq);
+ extern void record_vars_into (tree, tree);
+ extern void record_vars (tree);
+ 
+ #endif /* GCC_GIMPLE_LOW_H */
Index: gimple-low.c
===================================================================
*** gimple-low.c	(revision 203034)
--- gimple-low.c	(working copy)
*************** lower_try_catch (gimple_stmt_iterator *g
*** 598,653 ****
    gsi_next (gsi);
  }
  
- /* Try to determine whether a TRY_CATCH expression can fall through.
-    This is a subroutine of block_may_fallthru.  */
- 
- static bool
- try_catch_may_fallthru (const_tree stmt)
- {
-   tree_stmt_iterator i;
- 
-   /* If the TRY block can fall through, the whole TRY_CATCH can
-      fall through.  */
-   if (block_may_fallthru (TREE_OPERAND (stmt, 0)))
-     return true;
- 
-   i = tsi_start (TREE_OPERAND (stmt, 1));
-   switch (TREE_CODE (tsi_stmt (i)))
-     {
-     case CATCH_EXPR:
-       /* We expect to see a sequence of CATCH_EXPR trees, each with a
- 	 catch expression and a body.  The whole TRY_CATCH may fall
- 	 through iff any of the catch bodies falls through.  */
-       for (; !tsi_end_p (i); tsi_next (&i))
- 	{
- 	  if (block_may_fallthru (CATCH_BODY (tsi_stmt (i))))
- 	    return true;
- 	}
-       return false;
- 
-     case EH_FILTER_EXPR:
-       /* The exception filter expression only matters if there is an
- 	 exception.  If the exception does not match EH_FILTER_TYPES,
- 	 we will execute EH_FILTER_FAILURE, and we will fall through
- 	 if that falls through.  If the exception does match
- 	 EH_FILTER_TYPES, the stack unwinder will continue up the
- 	 stack, so we will not fall through.  We don't know whether we
- 	 will throw an exception which matches EH_FILTER_TYPES or not,
- 	 so we just ignore EH_FILTER_TYPES and assume that we might
- 	 throw an exception which doesn't match.  */
-       return block_may_fallthru (EH_FILTER_FAILURE (tsi_stmt (i)));
  
!     default:
!       /* This case represents statements to be executed when an
! 	 exception occurs.  Those statements are implicitly followed
! 	 by a RESX statement to resume execution after the exception.
! 	 So in this case the TRY_CATCH never falls through.  */
!       return false;
!     }
! }
! 
! 
! /* Same as above, but for a GIMPLE_TRY_CATCH.  */
  
  static bool
  gimple_try_catch_may_fallthru (gimple stmt)
--- 598,606 ----
    gsi_next (gsi);
  }
  
  
! /* Try to determine whether a TRY_CATCH expression can fall through.
!    This is a subroutine of gimple_stmt_may_fallthru.  */
  
  static bool
  gimple_try_catch_may_fallthru (gimple stmt)
*************** gimple_try_catch_may_fallthru (gimple st
*** 697,777 ****
      }
  }
  
- 
- /* Try to determine if we can fall out of the bottom of BLOCK.  This guess
-    need not be 100% accurate; simply be conservative and return true if we
-    don't know.  This is used only to avoid stupidly generating extra code.
-    If we're wrong, we'll just delete the extra code later.  */
- 
- bool
- block_may_fallthru (const_tree block)
- {
-   /* This CONST_CAST is okay because expr_last returns its argument
-      unmodified and we assign it to a const_tree.  */
-   const_tree stmt = expr_last (CONST_CAST_TREE (block));
- 
-   switch (stmt ? TREE_CODE (stmt) : ERROR_MARK)
-     {
-     case GOTO_EXPR:
-     case RETURN_EXPR:
-       /* Easy cases.  If the last statement of the block implies
- 	 control transfer, then we can't fall through.  */
-       return false;
- 
-     case SWITCH_EXPR:
-       /* If SWITCH_LABELS is set, this is lowered, and represents a
- 	 branch to a selected label and hence can not fall through.
- 	 Otherwise SWITCH_BODY is set, and the switch can fall
- 	 through.  */
-       return SWITCH_LABELS (stmt) == NULL_TREE;
- 
-     case COND_EXPR:
-       if (block_may_fallthru (COND_EXPR_THEN (stmt)))
- 	return true;
-       return block_may_fallthru (COND_EXPR_ELSE (stmt));
- 
-     case BIND_EXPR:
-       return block_may_fallthru (BIND_EXPR_BODY (stmt));
- 
-     case TRY_CATCH_EXPR:
-       return try_catch_may_fallthru (stmt);
- 
-     case TRY_FINALLY_EXPR:
-       /* The finally clause is always executed after the try clause,
- 	 so if it does not fall through, then the try-finally will not
- 	 fall through.  Otherwise, if the try clause does not fall
- 	 through, then when the finally clause falls through it will
- 	 resume execution wherever the try clause was going.  So the
- 	 whole try-finally will only fall through if both the try
- 	 clause and the finally clause fall through.  */
-       return (block_may_fallthru (TREE_OPERAND (stmt, 0))
- 	      && block_may_fallthru (TREE_OPERAND (stmt, 1)));
- 
-     case MODIFY_EXPR:
-       if (TREE_CODE (TREE_OPERAND (stmt, 1)) == CALL_EXPR)
- 	stmt = TREE_OPERAND (stmt, 1);
-       else
- 	return true;
-       /* FALLTHRU */
- 
-     case CALL_EXPR:
-       /* Functions that do not return do not fall through.  */
-       return (call_expr_flags (stmt) & ECF_NORETURN) == 0;
- 
-     case CLEANUP_POINT_EXPR:
-       return block_may_fallthru (TREE_OPERAND (stmt, 0));
- 
-     case TARGET_EXPR:
-       return block_may_fallthru (TREE_OPERAND (stmt, 1));
- 
-     case ERROR_MARK:
-       return true;
- 
-     default:
-       return lang_hooks.block_may_fallthru (stmt);
-     }
- }
- 
  
  /* Try to determine if we can continue executing the statement
     immediately following STMT.  This guess need not be 100% accurate;
--- 650,655 ----
Index: tree.c
===================================================================
*** tree.c	(revision 203034)
--- tree.c	(working copy)
*************** contains_bitfld_component_ref_p (const_t
*** 12125,12128 ****
--- 12125,12250 ----
    return false;
  }
  
+ /* Try to determine whether a TRY_CATCH expression can fall through.
+    This is a subroutine of block_may_fallthru.  */
+ 
+ static bool
+ try_catch_may_fallthru (const_tree stmt)
+ {
+   tree_stmt_iterator i;
+ 
+   /* If the TRY block can fall through, the whole TRY_CATCH can
+      fall through.  */
+   if (block_may_fallthru (TREE_OPERAND (stmt, 0)))
+     return true;
+ 
+   i = tsi_start (TREE_OPERAND (stmt, 1));
+   switch (TREE_CODE (tsi_stmt (i)))
+     {
+     case CATCH_EXPR:
+       /* We expect to see a sequence of CATCH_EXPR trees, each with a
+ 	 catch expression and a body.  The whole TRY_CATCH may fall
+ 	 through iff any of the catch bodies falls through.  */
+       for (; !tsi_end_p (i); tsi_next (&i))
+ 	{
+ 	  if (block_may_fallthru (CATCH_BODY (tsi_stmt (i))))
+ 	    return true;
+ 	}
+       return false;
+ 
+     case EH_FILTER_EXPR:
+       /* The exception filter expression only matters if there is an
+ 	 exception.  If the exception does not match EH_FILTER_TYPES,
+ 	 we will execute EH_FILTER_FAILURE, and we will fall through
+ 	 if that falls through.  If the exception does match
+ 	 EH_FILTER_TYPES, the stack unwinder will continue up the
+ 	 stack, so we will not fall through.  We don't know whether we
+ 	 will throw an exception which matches EH_FILTER_TYPES or not,
+ 	 so we just ignore EH_FILTER_TYPES and assume that we might
+ 	 throw an exception which doesn't match.  */
+       return block_may_fallthru (EH_FILTER_FAILURE (tsi_stmt (i)));
+ 
+     default:
+       /* This case represents statements to be executed when an
+ 	 exception occurs.  Those statements are implicitly followed
+ 	 by a RESX statement to resume execution after the exception.
+ 	 So in this case the TRY_CATCH never falls through.  */
+       return false;
+     }
+ }
+ 
+ /* Try to determine if we can fall out of the bottom of BLOCK.  This guess
+    need not be 100% accurate; simply be conservative and return true if we
+    don't know.  This is used only to avoid stupidly generating extra code.
+    If we're wrong, we'll just delete the extra code later.  */
+ 
+ bool
+ block_may_fallthru (const_tree block)
+ {
+   /* This CONST_CAST is okay because expr_last returns its argument
+      unmodified and we assign it to a const_tree.  */
+   const_tree stmt = expr_last (CONST_CAST_TREE (block));
+ 
+   switch (stmt ? TREE_CODE (stmt) : ERROR_MARK)
+     {
+     case GOTO_EXPR:
+     case RETURN_EXPR:
+       /* Easy cases.  If the last statement of the block implies
+ 	 control transfer, then we can't fall through.  */
+       return false;
+ 
+     case SWITCH_EXPR:
+       /* If SWITCH_LABELS is set, this is lowered, and represents a
+ 	 branch to a selected label and hence can not fall through.
+ 	 Otherwise SWITCH_BODY is set, and the switch can fall
+ 	 through.  */
+       return SWITCH_LABELS (stmt) == NULL_TREE;
+ 
+     case COND_EXPR:
+       if (block_may_fallthru (COND_EXPR_THEN (stmt)))
+ 	return true;
+       return block_may_fallthru (COND_EXPR_ELSE (stmt));
+ 
+     case BIND_EXPR:
+       return block_may_fallthru (BIND_EXPR_BODY (stmt));
+ 
+     case TRY_CATCH_EXPR:
+       return try_catch_may_fallthru (stmt);
+ 
+     case TRY_FINALLY_EXPR:
+       /* The finally clause is always executed after the try clause,
+ 	 so if it does not fall through, then the try-finally will not
+ 	 fall through.  Otherwise, if the try clause does not fall
+ 	 through, then when the finally clause falls through it will
+ 	 resume execution wherever the try clause was going.  So the
+ 	 whole try-finally will only fall through if both the try
+ 	 clause and the finally clause fall through.  */
+       return (block_may_fallthru (TREE_OPERAND (stmt, 0))
+ 	      && block_may_fallthru (TREE_OPERAND (stmt, 1)));
+ 
+     case MODIFY_EXPR:
+       if (TREE_CODE (TREE_OPERAND (stmt, 1)) == CALL_EXPR)
+ 	stmt = TREE_OPERAND (stmt, 1);
+       else
+ 	return true;
+       /* FALLTHRU */
+ 
+     case CALL_EXPR:
+       /* Functions that do not return do not fall through.  */
+       return (call_expr_flags (stmt) & ECF_NORETURN) == 0;
+ 
+     case CLEANUP_POINT_EXPR:
+       return block_may_fallthru (TREE_OPERAND (stmt, 0));
+ 
+     case TARGET_EXPR:
+       return block_may_fallthru (TREE_OPERAND (stmt, 1));
+ 
+     case ERROR_MARK:
+       return true;
+ 
+     default:
+       return lang_hooks.block_may_fallthru (stmt);
+     }
+ }
+ 
  #include "gt-tree.h"
Index: tree-scalar-evolution.c
===================================================================
*** tree-scalar-evolution.c	(revision 203034)
--- tree-scalar-evolution.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 256,261 ****
--- 256,262 ----
  #include "config.h"
  #include "system.h"
  #include "coretypes.h"
+ #include "tree.h"
  #include "hash-table.h"
  #include "gimple-pretty-print.h"
  #include "tree-ssa.h"
Index: sese.c
===================================================================
*** sese.c	(revision 203034)
--- sese.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 23,28 ****
--- 23,29 ----
  #include "system.h"
  #include "coretypes.h"
  #include "hash-table.h"
+ #include "tree.h"
  #include "tree-pretty-print.h"
  #include "tree-ssa.h"
  #include "cfgloop.h"
Index: dumpfile.c
===================================================================
*** dumpfile.c	(revision 203034)
--- dumpfile.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 22,29 ****
  #include "coretypes.h"
  #include "diagnostic-core.h"
  #include "dumpfile.h"
- #include "gimple-pretty-print.h"
  #include "tree.h"
  
  /* If non-NULL, return one past-the-end of the matching SUBPART of
     the WHOLE string.  */
--- 22,29 ----
  #include "coretypes.h"
  #include "diagnostic-core.h"
  #include "dumpfile.h"
  #include "tree.h"
+ #include "gimple-pretty-print.h"
  
  /* If non-NULL, return one past-the-end of the matching SUBPART of
     the WHOLE string.  */
Index: dwarf2out.c
===================================================================
*** dwarf2out.c	(revision 203034)
--- dwarf2out.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 92,97 ****
--- 92,98 ----
  #include "lra.h"
  #include "dumpfile.h"
  #include "opts.h"
+ #include "tree-dfa.h"
  
  static void dwarf2out_source_line (unsigned int, const char *, int, bool);
  static rtx last_var_location_insn;
Index: tree-chrec.c
===================================================================
*** tree-chrec.c	(revision 203034)
--- tree-chrec.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 26,31 ****
--- 26,32 ----
  #include "config.h"
  #include "system.h"
  #include "coretypes.h"
+ #include "tree.h"
  #include "tree-pretty-print.h"
  #include "cfgloop.h"
  #include "tree-ssa.h"
Index: tree-data-ref.c
===================================================================
*** tree-data-ref.c	(revision 203034)
--- tree-data-ref.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 76,81 ****
--- 76,82 ----
  #include "config.h"
  #include "system.h"
  #include "coretypes.h"
+ #include "tree.h"
  #include "gimple-pretty-print.h"
  #include "tree-ssa.h"
  #include "cfgloop.h"

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