aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2012-07-17 23:17:20 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2012-07-17 23:17:20 +0000
commita315c44ce0e466407809e4cb1c1f921aa08726b4 (patch)
tree9d5c1ea84c526379245c9986d831f4ce16757d79 /gcc/cfgrtl.c
parent9717f7a145b447c2c3dd00601de66be20d86261e (diff)
downloadgcc-a315c44ce0e466407809e4cb1c1f921aa08726b4.zip
gcc-a315c44ce0e466407809e4cb1c1f921aa08726b4.tar.gz
gcc-a315c44ce0e466407809e4cb1c1f921aa08726b4.tar.bz2
dumpfile.h (TDF_COMMENT): New define.
* dumpfile.h (TDF_COMMENT): New define. * basic-block.h (EDGE_FALLTHRU, EDGE_ABNORMAL, EDGE_ABNORMAL_CALL, EDGE_EH, EDGE_FAKE, EDGE_DFS_BACK, EDGE_CAN_FALLTHRU, EDGE_IRREDUCIBLE_LOOP, EDGE_SIBCALL, EDGE_LOOP_EXIT, EDGE_TRUE_VALUE, EDGE_FALSE_VALUE, EDGE_EXECUTABLE, EDGE_CROSSING, EDGE_PRESERVE): Move to new file cfg-flags.h. (enum cfg_edge_flags): New enum, using cfg-flags.h. (EDGE_ALL_FLAGS): Compute value automatically. (BB_NEW, BB_REACHABLE, BB_IRREDUCIBLE_LOOP, BB_SUPERBLOCK, BB_DISABLE_SCHEDULE, BB_HOT_PARTITION, BB_COLD_PARTITION, BB_DUPLICATED, BB_NON_LOCAL_GOTO_TARGET, BB_RTL, BB_FORWARDER_BLOCK, BB_NONTHREADABLE_BLOCK, BB_MODIFIED, BB_VISITED, BB_IN_TRANSACTION): Move to new file cfg-flags.h. (enum bb_flags): Rename to cfg_bb_flags. Use cfg-flags.h. (BB_ALL_FLAGS): New, compute value automatically. (dump_bb_info): Update prototype. (dump_edge_info): Update prototype. * cfg-flags.h: New file. * cfg.c (dump_edge_info): Take flags argument. Be verbose only if TDF_DETAILS and not TDF_SLIM. Include cfg-flags.h for bitnames. Check that the edge flags are within the range of EDGE_ALL_FLAGS. (debug_bb): Update dump_bb call. (dump_cfg_bb_info): Remove. (dump_bb_info): New function. Use cfg-flags.h for bitnames. Adjust verbosity using TDF_* flags. Check that the basic block flags are within the range of BB_ALL_FLAGS. (brief_dump_cfg): Use dump_bb_info instead of dump_cfg_bb_info. * cfghooks.h (struct cfghooks): Update dump_bb hook, take a FILE first for consistency with other dump functions. (dump_bb): Update prototype accordingly. * cfghooks.c: Include dumpfile.h. (verify_flow_info): Update dump_edge_info calls. (dump_bb): Take a flags argument and pass it around. Use dump_bb_info to dump common information about a basic block. (dump_flow_info): Moved here from cfgrtl.c. Make IL agnostic. (debug_flow_info): Moved here from cfgrtl.c. * profile.c (is_edge_inconsistent): Update dump_bb calls. * loop-invariant.c (find_defs): Update print_rtl_with_bb call. * rtl.h (debug_bb_n_slim, debug_bb_slim, print_rtl_slim, print_rtl_slim_with_bb): Remove prototypes. (dump_insn_slim): Adjust prototype to take a const_rtx. (print_rtl_with_bb): Adjust prototype. * sched-rgn.c (debug_region): Use dump_bb instead of debug_bb_n_slim. * sched-vis.c (dump_insn_slim): Take a const_rtx. (debug_insn_slim): Prototype here near DEBUG_FUNCTION marker. (print_rtl_slim_with_bb): Remove. (print_rtl_slim): Rename to debug_rtl_slim. Print only insn info, not basic block info (print_rtl_with_bb with TDF_SLIM should be used for that. Prototype here near DEBUG_FUNCTION marker. (debug_bb_slim): Prototype here near DEBUG_FUNCTION marker. Use dump_bb. (debug_bb_n_slim): Prototype here near DEBUG_FUNCTION marker. * tree-cfg.c (gimple_can_merge_blocks_p): Use EDGE_COMPLEX. (remove_bb): Update dump_bb call. (gimple_debug_bb): Use dump_bb. (dump_function_to_file): Update gimple_dump_bb call. (print_loops_bb): Likewise. * tree-flow.h (gimple_dump_bb): Update prototype. * gimple-pretty-print.c (dump_bb_header): Rename to dump_gimple_bb_header. Write to a stream instead of a pretty printer. Use dump_bb_info to dump basic block info. (dump_bb_end): Rename to dump_gimple_bb_footer. Write to a stream instead of a pretty printer. Use dump_bb_info. (gimple_dump_bb_buff): Do not call dump_bb_header and dump_bb_end. (gimple_dump_bb): Do it here with dump_gimple_bb_header and dump_gimple_bb_footer. * cfgrtl.c (rtl_dump_bb): Update prototype. Only dump DF if the dump flags have TDF_DETAILS. Use dump_insn_slim if TDF_SLIM. (print_rtl_with_bb): Take a flags argument and pass it around. Use dump_insn_slim if TDF_SLIM. (dump_bb_info): Removed and re-incarnated in cfg.c. (dump_flow_info): Moved to cfghooks.c. (debug_flow_info): Moved to cfghooks.c. * passes.c (execute_function_dump): Unconditionally use print_rtl_with_bb for RTL dumps, now that it understands TDF_SLIM. * final.c (dump_basic_block_info): Update dump_edge_info calls. * tree-vrp.c (dump_asserts_for): Likewise. * ifcvt.c (if_convert): Unconditionally use print_rtl_with_bb. * tree-if-conv.c (if_convertible_bb_p): Don't look at EDGE_ABNORMAL_CALL, it has no meaning in the GIMPLE world. * trans-mem.c (make_tm_edge): Don't set EDGE_ABNORMAL_CALL, for the same reason. * config/rl78/rl78.c (rl78_reorg): Update print_rtl_with_bb calls. From-SVN: r189590
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c146
1 files changed, 23 insertions, 123 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 34e8bd4..e87f06d 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -88,7 +88,7 @@ static void rtl_delete_block (basic_block);
static basic_block rtl_redirect_edge_and_branch_force (edge, basic_block);
static edge rtl_redirect_edge_and_branch (edge, basic_block);
static basic_block rtl_split_block (basic_block, void *);
-static void rtl_dump_bb (basic_block, FILE *, int, int);
+static void rtl_dump_bb (FILE *, basic_block, int, int);
static int rtl_verify_flow_info_1 (void);
static void rtl_make_forwarder_block (edge);
@@ -1836,10 +1836,11 @@ commit_edge_insertions (void)
/* Print out RTL-specific basic block information (live information
- at start and end). */
+ at start and end with TDF_DETAILS). FLAGS are the TDF_* masks
+ documented in dumpfile.h. */
static void
-rtl_dump_bb (basic_block bb, FILE *outf, int indent, int flags ATTRIBUTE_UNUSED)
+rtl_dump_bb (FILE *outf, basic_block bb, int indent, int flags)
{
rtx insn;
rtx last;
@@ -1849,7 +1850,7 @@ rtl_dump_bb (basic_block bb, FILE *outf, int indent, int flags ATTRIBUTE_UNUSED)
memset (s_indent, ' ', (size_t) indent);
s_indent[indent] = '\0';
- if (df)
+ if (df && (flags & TDF_DETAILS))
{
df_dump_top (bb, outf);
putc ('\n', outf);
@@ -1858,9 +1859,15 @@ rtl_dump_bb (basic_block bb, FILE *outf, int indent, int flags ATTRIBUTE_UNUSED)
if (bb->index != ENTRY_BLOCK && bb->index != EXIT_BLOCK)
for (insn = BB_HEAD (bb), last = NEXT_INSN (BB_END (bb)); insn != last;
insn = NEXT_INSN (insn))
- print_rtl_single (outf, insn);
+ {
+ if (! (flags & TDF_SLIM))
+ print_rtl_single (outf, insn);
+ else
+ dump_insn_slim (outf, insn);
+
+ }
- if (df)
+ if (df && (flags & TDF_DETAILS))
{
df_dump_bottom (bb, outf);
putc ('\n', outf);
@@ -1869,10 +1876,10 @@ rtl_dump_bb (basic_block bb, FILE *outf, int indent, int flags ATTRIBUTE_UNUSED)
}
/* Like print_rtl, but also print out live information for the start of each
- basic block. */
+ basic block. FLAGS are the flags documented in dumpfile.h. */
void
-print_rtl_with_bb (FILE *outf, const_rtx rtx_first)
+print_rtl_with_bb (FILE *outf, const_rtx rtx_first, int flags)
{
const_rtx tmp_rtx;
if (rtx_first == 0)
@@ -1911,12 +1918,9 @@ print_rtl_with_bb (FILE *outf, const_rtx rtx_first)
for (tmp_rtx = rtx_first; NULL != tmp_rtx; tmp_rtx = NEXT_INSN (tmp_rtx))
{
- int did_output;
- bool verbose = ((dump_flags & TDF_DETAILS) != 0);
-
bb = start[INSN_UID (tmp_rtx)];
if (bb != NULL)
- dump_bb_info (bb, true, false, verbose, ";; ", outf);
+ dump_bb_info (outf, bb, 0, dump_flags | TDF_COMMENT, true, false);
if (in_bb_p[INSN_UID (tmp_rtx)] == NOT_IN_BB
&& !NOTE_P (tmp_rtx)
@@ -1925,13 +1929,16 @@ print_rtl_with_bb (FILE *outf, const_rtx rtx_first)
else if (in_bb_p[INSN_UID (tmp_rtx)] == IN_MULTIPLE_BB)
fprintf (outf, ";; Insn is in multiple basic blocks\n");
- did_output = print_rtl_single (outf, tmp_rtx);
+ if (! (flags & TDF_SLIM))
+ print_rtl_single (outf, tmp_rtx);
+ else
+ dump_insn_slim (outf, tmp_rtx);
bb = end[INSN_UID (tmp_rtx)];
if (bb != NULL)
- dump_bb_info (bb, false, true, verbose, ";; ", outf);
- if (did_output)
- putc ('\n', outf);
+ dump_bb_info (outf, bb, 0, dump_flags | TDF_COMMENT, false, true);
+
+ putc ('\n', outf);
}
free (start);
@@ -1948,113 +1955,6 @@ print_rtl_with_bb (FILE *outf, const_rtx rtx_first)
}
}
-/* Emit basic block information for BB. HEADER is true if the user wants
- the generic information and the predecessors, FOOTER is true if they want
- the successors. If VERBOSE is true, emit global register liveness
- information. PREFIX is put in front of every line. The output is emitted
- to FILE. This function should only be called by RTL CFG users. */
-/* FIXME: Dumping of the basic block shared info (index, prev, next, etc.)
- is done here and also in dump_bb_header (but to a pretty-printer buffer).
- This should be re-factored to give similar dumps for RTL and GIMPLE. */
-
-void
-dump_bb_info (basic_block bb, bool header, bool footer, bool verbose,
- const char *prefix, FILE *file)
-{
- edge e;
- edge_iterator ei;
-
- if (header)
- {
- fprintf (file, "\n%sBasic block %d ", prefix, bb->index);
- if (bb->prev_bb)
- fprintf (file, ", prev %d", bb->prev_bb->index);
- if (bb->next_bb)
- fprintf (file, ", next %d", bb->next_bb->index);
- fprintf (file, ", loop_depth %d, count ", bb->loop_depth);
- fprintf (file, HOST_WIDEST_INT_PRINT_DEC, bb->count);
- fprintf (file, ", freq %i", bb->frequency);
- if (maybe_hot_bb_p (bb))
- fputs (", maybe hot", file);
- if (probably_never_executed_bb_p (bb))
- fputs (", probably never executed", file);
- if (bb->flags)
- {
- static const char * const bits[] = {
- "new", "reachable", "irr_loop", "superblock", "disable_sched",
- "hot_partition", "cold_partition", "duplicated",
- "non_local_goto_target", "rtl", "forwarder", "nonthreadable",
- "modified"
- };
- unsigned int flags;
-
- fputs (", flags:", file);
- for (flags = bb->flags; flags ; flags &= flags - 1)
- {
- unsigned i = ctz_hwi (flags);
- if (i < ARRAY_SIZE (bits))
- fprintf (file, " %s", bits[i]);
- else
- fprintf (file, " <%d>", i);
- }
- }
- fputs (".\n", file);
-
- fprintf (file, "%sPredecessors: ", prefix);
- FOR_EACH_EDGE (e, ei, bb->preds)
- dump_edge_info (file, e, 0);
-
- if (verbose
- && (bb->flags & BB_RTL)
- && df)
- {
- putc ('\n', file);
- df_dump_top (bb, file);
- }
- }
-
- if (footer)
- {
- fprintf (file, "\n%sSuccessors: ", prefix);
- FOR_EACH_EDGE (e, ei, bb->succs)
- dump_edge_info (file, e, 1);
-
- if (verbose
- && (bb->flags & BB_RTL)
- && df)
- {
- putc ('\n', file);
- df_dump_bottom (bb, file);
- }
- }
-
- putc ('\n', file);
-}
-
-
-void
-dump_flow_info (FILE *file, int flags)
-{
- basic_block bb;
- bool verbose = ((flags & TDF_DETAILS) != 0);
-
- fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
- FOR_ALL_BB (bb)
- {
- dump_bb_info (bb, true, true, verbose, "", file);
- check_bb_profile (bb, file);
- }
-
- putc ('\n', file);
-}
-
-void debug_flow_info (void);
-DEBUG_FUNCTION void
-debug_flow_info (void)
-{
- dump_flow_info (stderr, TDF_DETAILS);
-}
-
/* Update the branch probability of BB if a REG_BR_PROB is present. */
void