diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-07-17 23:17:20 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-07-17 23:17:20 +0000 |
commit | a315c44ce0e466407809e4cb1c1f921aa08726b4 (patch) | |
tree | 9d5c1ea84c526379245c9986d831f4ce16757d79 /gcc/basic-block.h | |
parent | 9717f7a145b447c2c3dd00601de66be20d86261e (diff) | |
download | gcc-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/basic-block.h')
-rw-r--r-- | gcc/basic-block.h | 125 |
1 files changed, 30 insertions, 95 deletions
diff --git a/gcc/basic-block.h b/gcc/basic-block.h index 7a89ef5..bf18bae 100644 --- a/gcc/basic-block.h +++ b/gcc/basic-block.h @@ -55,7 +55,7 @@ struct GTY(()) edge_def { dest->preds. */ unsigned int dest_idx; - int flags; /* see EDGE_* below */ + int flags; /* see cfg-flags.def */ int probability; /* biased by REG_BR_PROB_BASE */ gcov_type count; /* Expected number of executions calculated in profile.c */ @@ -65,32 +65,20 @@ DEF_VEC_P(edge); DEF_VEC_ALLOC_P(edge,gc); DEF_VEC_ALLOC_P(edge,heap); -/* Always update the table in cfg.c dump_edge_info. */ -#define EDGE_FALLTHRU 0x0001 /* 'Straight line' flow */ -#define EDGE_ABNORMAL 0x0002 /* Strange flow, like computed - label, or eh */ -#define EDGE_ABNORMAL_CALL 0x0004 /* Call with abnormal exit - like an exception, or sibcall */ -#define EDGE_EH 0x0008 /* Exception throw */ -#define EDGE_FAKE 0x0010 /* Not a real edge (profile.c) */ -#define EDGE_DFS_BACK 0x0020 /* A backwards edge */ -#define EDGE_CAN_FALLTHRU 0x0040 /* Candidate for straight line - flow. */ -#define EDGE_IRREDUCIBLE_LOOP 0x0080 /* Part of irreducible loop. */ -#define EDGE_SIBCALL 0x0100 /* Edge from sibcall to exit. */ -#define EDGE_LOOP_EXIT 0x0200 /* Exit of a loop. */ -#define EDGE_TRUE_VALUE 0x0400 /* Edge taken when controlling - predicate is nonzero. */ -#define EDGE_FALSE_VALUE 0x0800 /* Edge taken when controlling - predicate is zero. */ -#define EDGE_EXECUTABLE 0x1000 /* Edge is executable. Only - valid during SSA-CCP. */ -#define EDGE_CROSSING 0x2000 /* Edge crosses between hot - and cold sections, when we - do partitioning. */ -#define EDGE_PRESERVE 0x4000 /* Never merge blocks via this edge. */ -#define EDGE_ALL_FLAGS 0x7fff +/* Masks for edge.flags. */ +#define DEF_EDGE_FLAG(NAME,IDX) EDGE_##NAME = 1 << IDX , +enum cfg_edge_flags { +#include "cfg-flags.def" + LAST_CFG_EDGE_FLAG /* this is only used for EDGE_ALL_FLAGS */ +}; +#undef DEF_EDGE_FLAG + +/* Bit mask for all edge flags. */ +#define EDGE_ALL_FLAGS ((LAST_CFG_EDGE_FLAG - 1) * 2 - 1) +/* The following four flags all indicate something special about an edge. + Test the edge flags on EDGE_COMPLEX to detect all forms of "strange" + control flow transfers. */ #define EDGE_COMPLEX \ (EDGE_ABNORMAL | EDGE_ABNORMAL_CALL | EDGE_EH | EDGE_PRESERVE) @@ -184,10 +172,12 @@ struct GTY((chain_next ("%h.next_bb"), chain_prev ("%h.prev_bb"))) basic_block_d /* Expected frequency. Normalized to be in range 0 to BB_FREQ_MAX. */ int frequency; - /* The discriminator for this block. */ + /* The discriminator for this block. The discriminator distinguishes + among several basic blocks that share a common locus, allowing for + more accurate sample-based profiling. */ int discriminator; - /* Various flags. See BB_* below. */ + /* Various flags. See cfg-flags.def. */ int flags; }; @@ -204,74 +194,19 @@ DEF_VEC_ALLOC_P(basic_block,heap); #define BB_FREQ_MAX 10000 -/* Masks for basic_block.flags. - - BB_HOT_PARTITION and BB_COLD_PARTITION should be preserved throughout - the compilation, so they are never cleared. - - All other flags may be cleared by clear_bb_flags(). It is generally - a bad idea to rely on any flags being up-to-date. - - Always update the table in cfg.c dump_bb_info. */ - -enum bb_flags +/* Masks for basic_block.flags. */ +#define DEF_BASIC_BLOCK_FLAG(NAME,IDX) BB_##NAME = 1 << IDX , +enum cfg_bb_flags { - /* Only set on blocks that have just been created by create_bb. */ - BB_NEW = 1 << 0, - - /* Set by find_unreachable_blocks. Do not rely on this being set in any - pass. */ - BB_REACHABLE = 1 << 1, - - /* Set for blocks in an irreducible loop by loop analysis. */ - BB_IRREDUCIBLE_LOOP = 1 << 2, - - /* Set on blocks that may actually not be single-entry single-exit block. */ - BB_SUPERBLOCK = 1 << 3, - - /* Set on basic blocks that the scheduler should not touch. This is used - by SMS to prevent other schedulers from messing with the loop schedule. */ - BB_DISABLE_SCHEDULE = 1 << 4, - - /* Set on blocks that should be put in a hot section. */ - BB_HOT_PARTITION = 1 << 5, - - /* Set on blocks that should be put in a cold section. */ - BB_COLD_PARTITION = 1 << 6, - - /* Set on block that was duplicated. */ - BB_DUPLICATED = 1 << 7, - - /* Set if the label at the top of this block is the target of a non-local goto. */ - BB_NON_LOCAL_GOTO_TARGET = 1 << 8, - - /* Set on blocks that are in RTL format. */ - BB_RTL = 1 << 9 , - - /* Set on blocks that are forwarder blocks. - Only used in cfgcleanup.c. */ - BB_FORWARDER_BLOCK = 1 << 10, - - /* Set on blocks that cannot be threaded through. - Only used in cfgcleanup.c. */ - BB_NONTHREADABLE_BLOCK = 1 << 11, - - /* Set on blocks that were modified in some way. This bit is set in - df_set_bb_dirty, but not cleared by df_analyze, so it can be used - to test whether a block has been modified prior to a df_analyze - call. */ - BB_MODIFIED = 1 << 12, - - /* A general visited flag for passes to use. */ - BB_VISITED = 1 << 13, - - /* Set on blocks that are in a transaction. This is calculated on - demand, and is available after calling - compute_transaction_bits(). */ - BB_IN_TRANSACTION = 1 << 14 +#include "cfg-flags.def" + LAST_CFG_BB_FLAG /* this is only used for BB_ALL_FLAGS */ }; +#undef DEF_BASIC_BLOCK_FLAG + +/* Bit mask for all edge flags. */ +#define BB_ALL_FLAGS ((LAST_CFG_BB_FLAG - 1) * 2 - 1) -/* Dummy flag for convenience in the hot/cold partitioning code. */ +/* Dummy bitmask for convenience in the hot/cold partitioning code. */ #define BB_UNPARTITIONED 0 /* Partitions, to be used when partitioning hot and cold basic blocks into @@ -458,8 +393,8 @@ 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, rtx, rtx, basic_block); extern void clear_bb_flags (void); -extern void dump_bb_info (basic_block, bool, bool, bool, const char *, FILE *); -extern void dump_edge_info (FILE *, edge, int); +extern void dump_bb_info (FILE *, basic_block, int, int, bool, bool); +extern void dump_edge_info (FILE *, edge, int, int); extern void brief_dump_cfg (FILE *); extern void clear_edges (void); extern void scale_bbs_frequencies_int (basic_block *, int, int, int); |