diff mbox

Create cfgrtl.h

Message ID 5441475E.1010801@redhat.com
State New
Headers show

Commit Message

Andrew MacLeod Oct. 17, 2014, 4:44 p.m. UTC
Rather than trying to flatten basic-block.h and do all the work 
associated in one big patch,  I'll try to do it in smaller steps :-)

This patch creates cfgrtl.h to maintain the prototypes for functions 
exported from cfgrtl.c.  For the moment, basic-block.h  includes 
cfgrtl.h, keeping everything compiling.

When basic-block.h gets flattened, I'll reduce inclusion of cfgrtl.h to 
only files which actually need it.

I also took a couple of trivial things out of basic-block.h that didn't 
belong there:
  - extern const struct gcov_ctr_summary *profile_info;  belonged in 
profile.h since it is exported from profile.c.. This required a few .c 
files to include profile.h now.
  - the prototypes for gt_ggc_mx (edge_def *e) and gt_pch_nx (edge_def 
*e) were moved to tree-cfg.h since they are delcared in tree-cfg.c.

Bootstraps on x86_64-unknown-linux-gnu, and running test regressions, 
but compilation is likely to be enough to confirm its correct.

Assuming all is fine, OK for trunk?

Andrew

Comments

Richard Biener Oct. 20, 2014, 8:02 a.m. UTC | #1
On Fri, Oct 17, 2014 at 6:44 PM, Andrew MacLeod <amacleod@redhat.com> wrote:
> Rather than trying to flatten basic-block.h and do all the work associated
> in one big patch,  I'll try to do it in smaller steps :-)
>
> This patch creates cfgrtl.h to maintain the prototypes for functions
> exported from cfgrtl.c.  For the moment, basic-block.h  includes cfgrtl.h,
> keeping everything compiling.
>
> When basic-block.h gets flattened, I'll reduce inclusion of cfgrtl.h to only
> files which actually need it.
>
> I also took a couple of trivial things out of basic-block.h that didn't
> belong there:
>  - extern const struct gcov_ctr_summary *profile_info;  belonged in
> profile.h since it is exported from profile.c.. This required a few .c files
> to include profile.h now.
>  - the prototypes for gt_ggc_mx (edge_def *e) and gt_pch_nx (edge_def *e)
> were moved to tree-cfg.h since they are delcared in tree-cfg.c.
>
> Bootstraps on x86_64-unknown-linux-gnu, and running test regressions, but
> compilation is likely to be enough to confirm its correct.
>
> Assuming all is fine, OK for trunk?

Ok.

Thanks,
Richard.

> Andrew
diff mbox

Patch


	* cfgrtl.h: New.  Add prototypes for cfgrtl.c.
	* basic-block.h: Remove prototypes for cfgrtl.c.
	* cfghooks.h (cfg_layout_initialize, cfg_layout_finalize): Move
	prototypes to cfgrtl.h.
	* profile.h (profile_info): Add extern export declaration.
	* rtl.h: Remove prototypes for cfgrtl.h.
	* tree-cfg.h (gt_ggc_mx, gt_pch_nx): Move prototypes to here.
	* ipa-inline.c: Include profile.h.
	* loop-unroll.c: Ditto.
	* modulo-sched.c: Ditto.
	* postreload-gcse.c: Ditto.
	* predict.c: Ditto.
	* sched-ebb.c: Ditto.
	* sched-rgn.c: Ditto.
	* tracer.c: Ditto.
	* tree-ssa-loop-ivcanon.c: Ditto.


Index: cfgrtl.h
===================================================================
--- cfgrtl.h	(revision 0)
+++ cfgrtl.h	(working copy)
@@ -0,0 +1,58 @@ 
+/* Define control flow data structures for the CFG.
+   Copyright (C) 2014 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_CFGRTL_H
+#define GCC_CFGRTL_H
+
+extern void delete_insn (rtx);
+extern void delete_insn_and_edges (rtx_insn *);
+extern void delete_insn_chain (rtx, rtx, bool);
+extern basic_block create_basic_block_structure (rtx_insn *, rtx_insn *,
+						 rtx_note *, basic_block);
+extern void compute_bb_for_insn (void);
+extern unsigned int free_bb_for_insn (void);
+extern rtx_insn *entry_of_function (void);
+extern void update_bb_for_insn (basic_block);
+extern bool contains_no_active_insn_p (const_basic_block);
+extern bool forwarder_block_p (const_basic_block);
+extern bool can_fallthru (basic_block, basic_block);
+extern rtx_note *bb_note (basic_block);
+extern rtx block_label (basic_block);
+extern edge try_redirect_by_replacing_jump (edge, basic_block, bool);
+extern void emit_barrier_after_bb (basic_block bb);
+extern basic_block force_nonfallthru_and_redirect (edge, basic_block, rtx);
+extern void insert_insn_on_edge (rtx, edge);
+extern void commit_one_edge_insertion (edge e);
+extern void commit_edge_insertions (void);
+extern void print_rtl_with_bb (FILE *, const rtx_insn *, int);
+extern void update_br_prob_note (basic_block);
+extern rtx_insn *get_last_bb_insn (basic_block);
+extern void fixup_partitions (void);
+extern bool purge_dead_edges (basic_block);
+extern bool purge_all_dead_edges (void);
+extern bool fixup_abnormal_edges (void);
+extern rtx_insn *unlink_insn_chain (rtx_insn *, rtx_insn *);
+extern void relink_block_chain (bool);
+extern rtx_insn *duplicate_insn_chain (rtx_insn *, rtx_insn *);
+extern void cfg_layout_initialize (unsigned int);
+extern void cfg_layout_finalize (void);
+extern void break_superblocks (void);
+extern void init_rtl_bb_info (basic_block);
+
+#endif /* GCC_CFGRTL_H */
Index: basic-block.h
===================================================================
--- basic-block.h	(revision 216403)
+++ basic-block.h	(working copy)
@@ -29,6 +29,7 @@ 
 #include "hard-reg-set.h"
 #include "input.h"
 #include "function.h"
+#include "cfgrtl.h"
 
 /* Use gcov_type to hold basic block counters.  Should be at least
    64bit.  Although a counter cannot be negative, we use a signed
@@ -64,12 +65,6 @@ 
 				   in profile.c  */
 };
 
-
-/* Garbage collection and PCH support for edge_def.  */
-extern void gt_ggc_mx (edge_def *e);
-extern void gt_pch_nx (edge_def *e);
-extern void gt_pch_nx (edge_def *e, gt_pointer_operator, void *);
-
 /* Masks for edge.flags.  */
 #define DEF_EDGE_FLAG(NAME,IDX) EDGE_##NAME = 1 << IDX ,
 enum cfg_edge_flags {
@@ -87,10 +82,6 @@ 
 #define EDGE_COMPLEX \
   (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH | EDGE_PRESERVE)
 
-/* Counter summary from the last set of coverage counts read by
-   profile.c.  */
-extern const struct gcov_ctr_summary *profile_info;
-
 /* Structure to gather statistic about profile consistency, per pass.
    An array of this structure, indexed by pass static number, is allocated
    in passes.c.  The structure is defined here so that different CFG modes
@@ -122,8 +113,6 @@ 
   bool run;
 };
 
-/* Declared in cfgloop.h.  */
-struct loop;
 
 struct GTY(()) rtl_bb_info {
   /* The first insn of the block is embedded into bb->il.x.  */
@@ -391,16 +380,9 @@ 
 /* The two blocks that are always in the cfg.  */
 #define NUM_FIXED_BLOCKS (2)
 
-extern void compute_bb_for_insn (void);
-extern unsigned int free_bb_for_insn (void);
-extern void update_bb_for_insn (basic_block);
 
-extern void insert_insn_on_edge (rtx, edge);
 basic_block split_edge_and_insert (edge, rtx_insn *);
 
-extern void commit_one_edge_insertion (edge e);
-extern void commit_edge_insertions (void);
-
 extern edge unchecked_make_edge (basic_block, basic_block, int);
 extern edge cached_make_edge (sbitmap, basic_block, basic_block, int);
 extern edge make_edge (basic_block, basic_block, int);
@@ -409,8 +391,6 @@ 
 extern void redirect_edge_succ (edge, basic_block);
 extern edge redirect_edge_succ_nodup (edge, basic_block);
 extern void redirect_edge_pred (edge, basic_block);
-extern basic_block create_basic_block_structure (rtx_insn *, rtx_insn *,
-						 rtx_note *, basic_block);
 extern void clear_bb_flags (void);
 extern void dump_bb_info (FILE *, basic_block, int, int, bool, bool);
 extern void dump_edge_info (FILE *, edge, int, int);
@@ -797,19 +777,6 @@ 
 extern bitmap compute_idf (bitmap, struct bitmap_head *);
 extern basic_block * single_pred_before_succ_order (void);
 
-/* In cfgrtl.c  */
-extern rtx block_label (basic_block);
-extern rtx_note *bb_note (basic_block);
-extern bool purge_all_dead_edges (void);
-extern bool purge_dead_edges (basic_block);
-extern bool fixup_abnormal_edges (void);
-extern basic_block force_nonfallthru_and_redirect (edge, basic_block, rtx);
-extern bool contains_no_active_insn_p (const_basic_block);
-extern bool forwarder_block_p (const_basic_block);
-extern bool can_fallthru (basic_block, basic_block);
-extern void emit_barrier_after_bb (basic_block bb);
-extern void fixup_partitions (void);
-
 /* In cfgbuild.c.  */
 extern void find_many_sub_basic_blocks (sbitmap);
 extern void rtl_make_eh_edge (sbitmap, basic_block, rtx);
@@ -825,7 +792,6 @@ 
 
 extern bool delete_unreachable_blocks (void);
 
-extern void update_br_prob_note (basic_block);
 extern bool inside_basic_block_p (const rtx_insn *);
 extern bool control_flow_insn_p (const rtx_insn *);
 extern rtx_insn *get_last_bb_insn (basic_block);
@@ -875,11 +841,7 @@ 
 unsigned bb_dom_dfs_in (enum cdi_direction, basic_block);
 unsigned bb_dom_dfs_out (enum cdi_direction, basic_block);
 
-extern edge try_redirect_by_replacing_jump (edge, basic_block, bool);
-extern void break_superblocks (void);
-extern void relink_block_chain (bool);
 extern void update_bb_profile_for_threading (basic_block, int, gcov_type, edge);
-extern void init_rtl_bb_info (basic_block);
 
 extern void initialize_original_copy_tables (void);
 extern void free_original_copy_tables (void);
Index: cfghooks.h
===================================================================
--- cfghooks.h	(revision 216403)
+++ cfghooks.h	(working copy)
@@ -208,9 +208,6 @@ 
 
 void account_profile_record (struct profile_record *, int);
 
-extern void cfg_layout_initialize (unsigned int);
-extern void cfg_layout_finalize (void);
-
 /* Hooks containers.  */
 extern struct cfg_hooks gimple_cfg_hooks;
 extern struct cfg_hooks rtl_cfg_hooks;
Index: profile.h
===================================================================
--- profile.h	(revision 216403)
+++ profile.h	(working copy)
@@ -48,6 +48,10 @@ 
 
 extern void get_working_sets (void);
 
+/* Counter summary from the last set of coverage counts read by
+   profile.c.  */
+extern const struct gcov_ctr_summary *profile_info;
+
 /* In predict.c.  */
 extern gcov_type get_hot_bb_threshold (void);
 extern void set_hot_bb_threshold (gcov_type);
Index: rtl.h
===================================================================
--- rtl.h	(revision 216403)
+++ rtl.h	(working copy)
@@ -3372,12 +3372,7 @@ 
 extern void add_insn_after (rtx, rtx, basic_block);
 extern void remove_insn (rtx);
 extern rtx_insn *emit (rtx);
-extern void delete_insn (rtx);
-extern rtx_insn *entry_of_function (void);
 extern void emit_insn_at_entry (rtx);
-extern void delete_insn_chain (rtx, rtx, bool);
-extern rtx_insn *unlink_insn_chain (rtx_insn *, rtx_insn *);
-extern void delete_insn_and_edges (rtx_insn *);
 extern rtx gen_lowpart_SUBREG (enum machine_mode, rtx);
 extern rtx gen_const_mem (enum machine_mode, rtx);
 extern rtx gen_frame_mem (enum machine_mode, rtx);
@@ -3443,10 +3438,6 @@ 
 extern HOST_WIDE_INT find_args_size_adjust (rtx_insn *);
 extern int fixup_args_size_notes (rtx_insn *, rtx_insn *, int);
 
-/* In cfgrtl.c */
-extern void print_rtl_with_bb (FILE *, const rtx_insn *, int);
-extern rtx_insn *duplicate_insn_chain (rtx_insn *, rtx_insn *);
-
 /* In expmed.c */
 extern void init_expmed (void);
 extern void expand_inc (rtx, rtx);
Index: tree-cfg.h
===================================================================
--- tree-cfg.h	(revision 216403)
+++ tree-cfg.h	(working copy)
@@ -24,6 +24,11 @@ 
 /* Location to track pending stmt for edge insertion.  */
 #define PENDING_STMT(e)	((e)->insns.g)
 
+/* Garbage collection and PCH support for edge_def.  */
+extern void gt_ggc_mx (edge_def *e);
+extern void gt_pch_nx (edge_def *e);
+extern void gt_pch_nx (edge_def *e, gt_pointer_operator, void *);
+
 extern void init_empty_tree_cfg_for_function (struct function *);
 extern void init_empty_tree_cfg (void);
 extern void fold_cond_expr_cond (void);
Index: ipa-inline.c
===================================================================
--- ipa-inline.c	(revision 216403)
+++ ipa-inline.c	(working copy)
@@ -108,6 +108,7 @@ 
 #include "coverage.h"
 #include "rtl.h"
 #include "bitmap.h"
+#include "profile.h"
 #include "basic-block.h"
 #include "tree-ssa-alias.h"
 #include "internal-fn.h"
Index: loop-unroll.c
===================================================================
--- loop-unroll.c	(revision 216403)
+++ loop-unroll.c	(working copy)
@@ -25,6 +25,7 @@ 
 #include "tree.h"
 #include "hard-reg-set.h"
 #include "obstack.h"
+#include "profile.h"
 #include "basic-block.h"
 #include "cfgloop.h"
 #include "params.h"
Index: modulo-sched.c
===================================================================
--- modulo-sched.c	(revision 216403)
+++ modulo-sched.c	(working copy)
@@ -34,6 +34,7 @@ 
 #include "machmode.h"
 #include "input.h"
 #include "function.h"
+#include "profile.h"
 #include "flags.h"
 #include "insn-config.h"
 #include "insn-attr.h"
Index: postreload-gcse.c
===================================================================
--- postreload-gcse.c	(revision 216403)
+++ postreload-gcse.c	(working copy)
@@ -39,6 +39,7 @@ 
 #include "machmode.h"
 #include "input.h"
 #include "function.h"
+#include "profile.h"
 #include "expr.h"
 #include "except.h"
 #include "intl.h"
Index: predict.c
===================================================================
--- predict.c	(revision 216403)
+++ predict.c	(working copy)
@@ -46,6 +46,7 @@ 
 #include "machmode.h"
 #include "input.h"
 #include "function.h"
+#include "profile.h"
 #include "except.h"
 #include "diagnostic-core.h"
 #include "recog.h"
@@ -2527,6 +2528,7 @@ 
 };
 
 #define BLOCK_INFO(B)	((block_info *) (B)->aux)
+#undef EDGE_INFO
 #define EDGE_INFO(E)	((edge_prob_info *) (E)->aux)
 
 /* Helper function for estimate_bb_frequencies.
Index: sched-ebb.c
===================================================================
--- sched-ebb.c	(revision 216403)
+++ sched-ebb.c	(working copy)
@@ -34,6 +34,7 @@ 
 #include "machmode.h"
 #include "input.h"
 #include "function.h"
+#include "profile.h"
 #include "flags.h"
 #include "insn-config.h"
 #include "insn-attr.h"
Index: sched-rgn.c
===================================================================
--- sched-rgn.c	(revision 216403)
+++ sched-rgn.c	(working copy)
@@ -58,6 +58,7 @@ 
 #include "machmode.h"
 #include "input.h"
 #include "function.h"
+#include "profile.h"
 #include "flags.h"
 #include "insn-config.h"
 #include "insn-attr.h"
Index: tracer.c
===================================================================
--- tracer.c	(revision 216403)
+++ tracer.c	(working copy)
@@ -40,6 +40,7 @@ 
 #include "tree.h"
 #include "rtl.h"
 #include "hard-reg-set.h"
+#include "profile.h"
 #include "basic-block.h"
 #include "fibheap.h"
 #include "flags.h"
Index: tree-ssa-loop-ivcanon.c
===================================================================
--- tree-ssa-loop-ivcanon.c	(revision 216403)
+++ tree-ssa-loop-ivcanon.c	(working copy)
@@ -41,6 +41,7 @@ 
 #include "tm.h"
 #include "tree.h"
 #include "tm_p.h"
+#include "profile.h"
 #include "basic-block.h"
 #include "gimple-pretty-print.h"
 #include "tree-ssa-alias.h"