diff mbox

Rename tree-flow.h to tree-cfg.h.

Message ID 5260856C.7070008@redhat.com
State New
Headers show

Commit Message

Andrew MacLeod Oct. 18, 2013, 12:48 a.m. UTC
This patch finally renames tree-flow.h to tree-cfg.h.  It now contains 
just the prototypes for tree-cfg.h.
I've also removed all the #include's from tree-cfg.h, and relocated them 
(temporarily) to tree-ssa.h which is acting as the tree-ssa module header.

tree-flow.h is removed from all includes, and a few places were tweaked 
to include just the bit(s) they may have needed from the old tree-flow.h 
list. (for instance, gimple.c only needed bitmap.h, nothing else :-P)

virtual_operand_p is removed from tree-ssa-operands.h and relocated to 
gimple.c.  It actually has nothing to do with operand processing, merely 
queries whether a given VAR_DECL is the global variable for VOPs. 
(VAR_DECL_CHECK (NODE)->base.u.bits.saturating_flag). So I dont think it 
even counts as a border routine for gimple-ssa.h. Moving this prevented 
tree-ssa-operands.h from being required in a couple of files that 
shouldn't need it..

A set of 8 more patches will follow this (very simple ones :-) which 
reduce the include list out of tree-ssa.h to just files which are 
commonly used.

rs6000 and alpha were including tree-flow.h in their config/target.c 
file. I built stage 1 for each target as a cross compiler to confirm 
builds dont break due to something unresolved.  rs6000.c no longer 
needed it, alpha needs num_ssa_names, so it requires gimple-ssa.h 
(instead of tree-flow.h).   There is a compilation error in alpha (like 
on many other targets) for target_flags_explicit.... when it fails, that 
is the only unresolved external left.... the situation which existed 
before this patch.

gimple-ssa.h cannot be compiled without tree-ssa-operands.h (it requires 
some structs and fields), so I #include tree-ssa-operands.h *back* into 
gimple-ssa.h where it was a week ago... not sure why I took it out.  oops.

Bootstraps on x86_64-unknown-linux-gnu with no new regressions.

OK?

Andrew

Comments

Richard Biener Oct. 18, 2013, 9 a.m. UTC | #1
On Fri, Oct 18, 2013 at 2:48 AM, Andrew MacLeod <amacleod@redhat.com> wrote:
> This patch finally renames tree-flow.h to tree-cfg.h.  It now contains just
> the prototypes for tree-cfg.h.

Yay!

> I've also removed all the #include's from tree-cfg.h, and relocated them
> (temporarily) to tree-ssa.h which is acting as the tree-ssa module header.
>
> tree-flow.h is removed from all includes, and a few places were tweaked to
> include just the bit(s) they may have needed from the old tree-flow.h list.
> (for instance, gimple.c only needed bitmap.h, nothing else :-P)
>
> virtual_operand_p is removed from tree-ssa-operands.h and relocated to
> gimple.c.  It actually has nothing to do with operand processing, merely
> queries whether a given VAR_DECL is the global variable for VOPs.
> (VAR_DECL_CHECK (NODE)->base.u.bits.saturating_flag). So I dont think it
> even counts as a border routine for gimple-ssa.h. Moving this prevented
> tree-ssa-operands.h from being required in a couple of files that shouldn't
> need it..

You could argue it belongs to tree-ssa-alias.h as it is a GIMPLE alias
machinery specific var ...

> A set of 8 more patches will follow this (very simple ones :-) which reduce
> the include list out of tree-ssa.h to just files which are commonly used.
>
> rs6000 and alpha were including tree-flow.h in their config/target.c file. I
> built stage 1 for each target as a cross compiler to confirm builds dont
> break due to something unresolved.  rs6000.c no longer needed it, alpha
> needs num_ssa_names, so it requires gimple-ssa.h (instead of tree-flow.h).
> There is a compilation error in alpha (like on many other targets) for
> target_flags_explicit.... when it fails, that is the only unresolved
> external left.... the situation which existed before this patch.
>
> gimple-ssa.h cannot be compiled without tree-ssa-operands.h (it requires
> some structs and fields), so I #include tree-ssa-operands.h *back* into
> gimple-ssa.h where it was a week ago... not sure why I took it out.  oops.
>
> Bootstraps on x86_64-unknown-linux-gnu with no new regressions.
>
> OK?

Ok.

Thanks,
Richard.

> Andrew
>
diff mbox

Patch



	* tree-cfg.h: Rename from tree-flow.h.  Remove #includes.
	* tree-ssa.h: Relocate required #includes from tree-cfg.h.
	* tree-ssa-operands.h: Remove prototype.
	* tree-ssa-operands.c (virtual_operand_p): Move to gimple.c.
	* gimple.c (virtual_operand_p): Relocate from gimple.c.
	* gimple.h: Add prototype.
	* gimple-ssa.h: Include tree-ssa-operands.h.
	* tree-dump.c: Add tree-cfg.h to include list.
	* tree-ssa-alias.c: Add ipa-reference.h to include list.
	* lto/lto.c: Remove tree-flow.h from include list.
	* config/alpha/alpha.c: Include gimple-ssa.h instead of tree-flow.h.
	* config/i386/i386.c: Don't include tree-flow.h.
	* config/rs6000/rs6000.c: Likewise.
	* testsuite/g++.dg/plugin/header_plugin.c: Likewise.

Index: tree-cfg.h
===================================================================
*** tree-cfg.h	(working copy)
--- tree-cfg.h	(working copy)
*************** You should have received a copy of the G
*** 18,41 ****
  along with GCC; see the file COPYING3.  If not see
  <http://www.gnu.org/licenses/>.  */
  
! #ifndef _TREE_FLOW_H
! #define _TREE_FLOW_H 1
! 
! #include "bitmap.h"
! #include "sbitmap.h"
! #include "basic-block.h"
! #include "hashtab.h"
! #include "gimple.h"
! #include "tree-ssa-operands.h"
! #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"
! #include "tree-ssa-loop.h"
  
  /* Location to track pending stmt for edge insertion.  */
  #define PENDING_STMT(e)	((e)->insns.g)
--- 18,25 ----
  along with GCC; see the file COPYING3.  If not see
  <http://www.gnu.org/licenses/>.  */
  
! #ifndef _TREE_CFG_H
! #define _TREE_CFG_H
  
  /* Location to track pending stmt for edge insertion.  */
  #define PENDING_STMT(e)	((e)->insns.g)
*************** extern void debug_verbose (struct loop *
*** 95,101 ****
  extern void debug_loops (int);
  extern void debug_loop (struct loop *, int);
  extern void debug_loop_num (unsigned, int);
! void remove_edge_and_dominated_blocks (edge);
  extern bool gimple_purge_dead_eh_edges (basic_block);
  extern bool gimple_purge_all_dead_eh_edges (const_bitmap);
  extern bool gimple_purge_dead_abnormal_call_edges (basic_block);
--- 79,85 ----
  extern void debug_loops (int);
  extern void debug_loop (struct loop *, int);
  extern void debug_loop_num (unsigned, int);
! extern void remove_edge_and_dominated_blocks (edge);
  extern bool gimple_purge_dead_eh_edges (basic_block);
  extern bool gimple_purge_all_dead_eh_edges (const_bitmap);
  extern bool gimple_purge_dead_abnormal_call_edges (basic_block);
*************** extern tree gimplify_build1 (gimple_stmt
*** 109,112 ****
  extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
  extern unsigned int execute_fixup_cfg (void);
  
! #endif /* _TREE_FLOW_H  */
--- 93,96 ----
  extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
  extern unsigned int execute_fixup_cfg (void);
  
! #endif /* _TREE_CFG_H  */
Index: tree-flow.h
===================================================================
*** tree-flow.h	(revision 203786)
--- tree-flow.h	(working copy)
***************
*** 1,112 ****
- /* Data and Control Flow Analysis for Trees.
-    Copyright (C) 2001-2013 Free Software Foundation, Inc.
-    Contributed by Diego Novillo <dnovillo@redhat.com>
- 
- 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 _TREE_FLOW_H
- #define _TREE_FLOW_H 1
- 
- #include "bitmap.h"
- #include "sbitmap.h"
- #include "basic-block.h"
- #include "hashtab.h"
- #include "gimple.h"
- #include "tree-ssa-operands.h"
- #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"
- #include "tree-ssa-loop.h"
- 
- /* Location to track pending stmt for edge insertion.  */
- #define PENDING_STMT(e)	((e)->insns.g)
- 
- extern void init_empty_tree_cfg_for_function (struct function *);
- extern void init_empty_tree_cfg (void);
- extern void fold_cond_expr_cond (void);
- extern void start_recording_case_labels (void);
- extern void end_recording_case_labels (void);
- extern basic_block label_to_block_fn (struct function *, tree);
- #define label_to_block(t) (label_to_block_fn (cfun, t))
- extern void make_abnormal_goto_edges (basic_block, bool);
- extern void cleanup_dead_labels (void);
- extern void group_case_labels_stmt (gimple);
- extern void group_case_labels (void);
- extern void replace_uses_by (tree, tree);
- extern basic_block single_noncomplex_succ (basic_block bb);
- extern void notice_special_calls (gimple);
- extern void clear_special_calls (void);
- extern edge find_taken_edge (basic_block, tree);
- extern void gimple_debug_bb (basic_block);
- extern basic_block gimple_debug_bb_n (int);
- extern void gimple_debug_cfg (int);
- extern void gimple_dump_cfg (FILE *, int);
- extern void dump_cfg_stats (FILE *);
- extern void debug_cfg_stats (void);
- extern bool stmt_can_make_abnormal_goto (gimple);
- extern bool is_ctrl_stmt (gimple);
- extern bool is_ctrl_altering_stmt (gimple);
- extern bool simple_goto_p (gimple);
- extern bool stmt_ends_bb_p (gimple);
- extern void delete_tree_cfg_annotations (void);
- extern gimple first_stmt (basic_block);
- extern gimple last_stmt (basic_block);
- extern gimple last_and_only_stmt (basic_block);
- extern void verify_gimple_in_seq (gimple_seq);
- extern void verify_gimple_in_cfg (struct function *);
- extern tree gimple_block_label (basic_block);
- extern void add_phi_args_after_copy_bb (basic_block);
- extern void add_phi_args_after_copy (basic_block *, unsigned, edge);
- extern bool gimple_duplicate_sese_region (edge, edge, basic_block *, unsigned,
- 					basic_block *, bool);
- extern bool gimple_duplicate_sese_tail (edge, edge, basic_block *, unsigned,
- 				      basic_block *);
- extern void gather_blocks_in_sese_region (basic_block entry, basic_block exit,
- 					  vec<basic_block> *bbs_p);
- extern basic_block move_sese_region_to_fn (struct function *, basic_block,
- 				           basic_block, tree);
- extern void dump_function_to_file (tree, FILE *, int);
- extern void debug_function (tree, int) ;
- extern void print_loops_bb (FILE *, basic_block, int, int);
- extern void print_loops (FILE *, int);
- extern void debug (struct loop &ref);
- extern void debug (struct loop *ptr);
- extern void debug_verbose (struct loop &ref);
- extern void debug_verbose (struct loop *ptr);
- extern void debug_loops (int);
- extern void debug_loop (struct loop *, int);
- extern void debug_loop_num (unsigned, int);
- void remove_edge_and_dominated_blocks (edge);
- extern bool gimple_purge_dead_eh_edges (basic_block);
- extern bool gimple_purge_all_dead_eh_edges (const_bitmap);
- extern bool gimple_purge_dead_abnormal_call_edges (basic_block);
- extern bool gimple_purge_all_dead_abnormal_call_edges (const_bitmap);
- extern tree gimplify_build3 (gimple_stmt_iterator *, enum tree_code,
- 			     tree, tree, tree, tree);
- extern tree gimplify_build2 (gimple_stmt_iterator *, enum tree_code,
- 			     tree, tree, tree);
- extern tree gimplify_build1 (gimple_stmt_iterator *, enum tree_code,
- 			     tree, tree);
- extern void extract_true_false_edges_from_block (basic_block, edge *, edge *);
- extern unsigned int execute_fixup_cfg (void);
- 
- #endif /* _TREE_FLOW_H  */
--- 0 ----
Index: tree-ssa.h
===================================================================
*** tree-ssa.h	(revision 203785)
--- tree-ssa.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 20,35 ****
  #ifndef GCC_TREE_SSA_H
  #define GCC_TREE_SSA_H
  
  #include "gimple.h"
- #include "tree-ssa-operands.h"
- #include "tree-phinodes.h"
  #include "gimple-ssa.h"
  #include "ssa-iterators.h"
  #include "tree-ssanames.h"
  #include "tree-ssa-dom.h"
- #include "tree-flow.h"
  #include "tree-ssa-threadedge.h"
  #include "tree-ssa-address.h"
  
  /* Mapping for redirected edges.  */
  struct _edge_var_map {
--- 20,42 ----
  #ifndef GCC_TREE_SSA_H
  #define GCC_TREE_SSA_H
  
+ #include "bitmap.h"
+ #include "sbitmap.h"
  #include "gimple.h"
  #include "gimple-ssa.h"
+ #include "cgraph.h"
+ #include "tree-cfgcleanup.h"
+ #include "tree-cfg.h"
+ #include "tree-phinodes.h"
  #include "ssa-iterators.h"
  #include "tree-ssanames.h"
  #include "tree-ssa-dom.h"
  #include "tree-ssa-threadedge.h"
  #include "tree-ssa-address.h"
+ #include "tree-ssa-loop.h"
+ #include "tree-into-ssa.h"
+ #include "gimple-low.h"
+ #include "tree-dfa.h"
  
  /* Mapping for redirected edges.  */
  struct _edge_var_map {
Index: tree-ssa-operands.h
===================================================================
*** tree-ssa-operands.h	(revision 203785)
--- tree-ssa-operands.h	(working copy)
*************** extern void dump_immediate_uses (FILE *f
*** 103,109 ****
  extern void debug_immediate_uses (void);
  extern void debug_immediate_uses_for (tree var);
  
- extern bool virtual_operand_p (tree);
  extern void unlink_stmt_vdef (gimple);
  
  /* Return the tree pointed-to by USE.  */
--- 103,108 ----
Index: tree-ssa-operands.c
===================================================================
*** tree-ssa-operands.c	(revision 203785)
--- tree-ssa-operands.c	(working copy)
*************** debug_immediate_uses_for (tree var)
*** 1287,1310 ****
  }
  
  
- /* Return true if OP, an SSA name or a DECL is a virtual operand.  */
- 
- bool
- virtual_operand_p (tree op)
- {
-   if (TREE_CODE (op) == SSA_NAME)
-     {
-       op = SSA_NAME_VAR (op);
-       if (!op)
- 	return false;
-     }
- 
-   if (TREE_CODE (op) == VAR_DECL)
-     return VAR_DECL_IS_VIRTUAL_OPERAND (op);
- 
-   return false;
- }
- 
  /* Unlink STMTs virtual definition from the IL by propagating its use.  */
  
  void
--- 1287,1292 ----
Index: gimple.c
===================================================================
*** gimple.c	(revision 203786)
--- gimple.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 30,41 ****
  #include "basic-block.h"
  #include "gimple.h"
  #include "diagnostic.h"
- #include "tree-flow.h"
  #include "value-prof.h"
  #include "flags.h"
  #include "alias.h"
  #include "demangle.h"
  #include "langhooks.h"
  
  
  /* All the tuples have their operand vector (if present) at the very bottom
--- 30,41 ----
  #include "basic-block.h"
  #include "gimple.h"
  #include "diagnostic.h"
  #include "value-prof.h"
  #include "flags.h"
  #include "alias.h"
  #include "demangle.h"
  #include "langhooks.h"
+ #include "bitmap.h"
  
  
  /* All the tuples have their operand vector (if present) at the very bottom
*************** is_gimple_id (tree t)
*** 2776,2781 ****
--- 2776,2800 ----
  	  || TREE_CODE (t) == STRING_CST);
  }
  
+ /* Return true if OP, an SSA name or a DECL is a virtual operand.  */
+ 
+ bool
+ virtual_operand_p (tree op)
+ {
+   if (TREE_CODE (op) == SSA_NAME)
+     {
+       op = SSA_NAME_VAR (op);
+       if (!op)
+ 	return false;
+     }
+ 
+   if (TREE_CODE (op) == VAR_DECL)
+     return VAR_DECL_IS_VIRTUAL_OPERAND (op);
+ 
+   return false;
+ }
+ 
+ 
  /* Return true if T is a non-aggregate register variable.  */
  
  bool
Index: gimple.h
===================================================================
*** gimple.h	(revision 203786)
--- gimple.h	(working copy)
*************** unsigned get_gimple_rhs_num_ops (enum tr
*** 847,852 ****
--- 847,854 ----
  gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL);
  const char *gimple_decl_printable_name (tree, int);
  
+ /* Returns true iff T is a virtual ssa name decl.  */
+ extern bool virtual_operand_p (tree);
  /* Returns true iff T is a scalar register variable.  */
  extern bool is_gimple_reg (tree);
  /* Returns true iff T is any sort of variable.  */
Index: gimple-ssa.h
===================================================================
*** gimple-ssa.h	(revision 203785)
--- gimple-ssa.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 21,26 ****
--- 21,28 ----
  #ifndef GCC_GIMPLE_SSA_H
  #define GCC_GIMPLE_SSA_H
  
+ #include "tree-ssa-operands.h"
+ 
  /* This structure is used to map a gimple statement to a label,
     or list of labels to represent transaction restart.  */
  
*************** gimple_in_ssa_p (const struct function *
*** 92,100 ****
    return fun && fun->gimple_df && fun->gimple_df->in_ssa_p;
  }
  
- /* Inline functions for manipulating various data structures defined in
-    tree-flow.h.  See tree-flow.h for documentation.  */
- 
  /* Artificial variable used for the virtual operand FUD chain.  */
  static inline tree
  gimple_vop (const struct function *fun)
--- 94,99 ----
Index: tree-dump.c
===================================================================
*** tree-dump.c	(revision 203785)
--- tree-dump.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 29,35 ****
  #include "langhooks.h"
  #include "tree-iterator.h"
  #include "tree-pretty-print.h"
! #include "tree-flow.h"
  
  static unsigned int queue (dump_info_p, const_tree, int);
  static void dump_index (dump_info_p, unsigned int);
--- 29,35 ----
  #include "langhooks.h"
  #include "tree-iterator.h"
  #include "tree-pretty-print.h"
! #include "tree-cfg.h"
  
  static unsigned int queue (dump_info_p, const_tree, int);
  static void dump_index (dump_info_p, unsigned int);
Index: tree-ssa-alias.c
===================================================================
*** tree-ssa-alias.c	(revision 203785)
--- tree-ssa-alias.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 42,47 ****
--- 42,48 ----
  #include "pointer-set.h"
  #include "alloc-pool.h"
  #include "tree-ssa-alias.h"
+ #include "ipa-reference.h"
  
  /* Broad overview of how alias analysis on gimple works:
  
Index: lto/lto.c
===================================================================
*** lto/lto.c	(revision 203785)
--- lto/lto.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 24,30 ****
  #include "opts.h"
  #include "toplev.h"
  #include "tree.h"
- #include "tree-flow.h"
  #include "diagnostic-core.h"
  #include "tm.h"
  #include "cgraph.h"
--- 24,29 ----
Index: config/alpha/alpha.c
===================================================================
*** config/alpha/alpha.c	(revision 203785)
--- config/alpha/alpha.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 49,55 ****
  #include "langhooks.h"
  #include "splay-tree.h"
  #include "gimple.h"
! #include "tree-flow.h"
  #include "tree-ssanames.h"
  #include "tree-stdarg.h"
  #include "tm-constrs.h"
--- 49,55 ----
  #include "langhooks.h"
  #include "splay-tree.h"
  #include "gimple.h"
! #include "gimple-ssa.h"
  #include "tree-ssanames.h"
  #include "tree-stdarg.h"
  #include "tm-constrs.h"
*************** along with GCC; see the file COPYING3.
*** 57,63 ****
  #include "libfuncs.h"
  #include "opts.h"
  #include "params.h"
- #include "gimple-ssa.h"
  
  /* Specify which cpu to schedule for.  */
  enum processor_type alpha_tune;
--- 57,62 ----
Index: config/i386/i386.c
===================================================================
*** config/i386/i386.c	(revision 203785)
--- config/i386/i386.c	(working copy)
*************** along with GCC; see the file COPYING3.
*** 61,67 ****
  #include "diagnostic.h"
  #include "dumpfile.h"
  #include "tree-pass.h"
- #include "tree-flow.h"
  #include "context.h"
  #include "pass_manager.h"
  
--- 61,66 ----
Index: config/rs6000/rs6000.c
===================================================================
*** config/rs6000/rs6000.c	(revision 203785)
--- config/rs6000/rs6000.c	(working copy)
***************
*** 52,58 ****
  #include "cfgloop.h"
  #include "sched-int.h"
  #include "gimple.h"
- #include "tree-flow.h"
  #include "intl.h"
  #include "params.h"
  #include "tm-constrs.h"
--- 52,57 ----
Index: testsuite/g++.dg/plugin/header_plugin.c
===================================================================
*** testsuite/g++.dg/plugin/header_plugin.c	(revision 203785)
--- testsuite/g++.dg/plugin/header_plugin.c	(working copy)
***************
*** 17,23 ****
  #include "c-family/c-pretty-print.h"
  #include "tree-iterator.h"
  #include "plugin.h"
- #include "tree-flow.h"
  #include "langhooks.h"
  #include "cp/cxx-pretty-print.h"
  #include "cp/name-lookup.h"
--- 17,22 ----