Commit 2dd2d53e by Steven Bosscher Committed by Steven Bosscher

basic-block.h: Give the BB flags enum a name, bb_flags.

	* basic-block.h: Give the BB flags enum a name, bb_flags.
	Add new flags BB_FORWARDER_BLOCK, and BB_NONTHREADABLE_BLOCK.
	* cfgcleanup.c (enum bb_flags): Remove here.
	(BB_FLAGS, BB_SET_FLAG, BB_CLEAR_FLAG): Remove.
	(notice_new_block): Set/test bb->flags instead of aux via BB_FLAGS.
	(update_forwarder_flag): Likewise.
	(thread_jump): Likewise.
	(try_forward_edges): Likewise.
	(try_optimize_cfg): Likewise.  Clear bb->flags before updating the
	forwarder flags.  Don't clear bb->aux for all basic blocks.  Only
	reset the BB_FORWARDER_BLOCK and BB_NONTHREADABLE_BLOCK flags.

From-SVN: r101876
parent 8637038a
2005-07-11 Steven Bosscher <stevenb@suse.de>
* basic-block.h: Give the BB flags enum a name, bb_flags.
Add new flags BB_FORWARDER_BLOCK, and BB_NONTHREADABLE_BLOCK.
* cfgcleanup.c (enum bb_flags): Remove here.
(BB_FLAGS, BB_SET_FLAG, BB_CLEAR_FLAG): Remove.
(notice_new_block): Set/test bb->flags instead of aux via BB_FLAGS.
(update_forwarder_flag): Likewise.
(thread_jump): Likewise.
(try_forward_edges): Likewise.
(try_optimize_cfg): Likewise. Clear bb->flags before updating the
forwarder flags. Don't clear bb->aux for all basic blocks. Only
reset the BB_FORWARDER_BLOCK and BB_NONTHREADABLE_BLOCK flags.
2005-07-11 Richard Guenther <rguenther@suse.de> 2005-07-11 Richard Guenther <rguenther@suse.de>
* config/i386/i386.opt: New target option -msseregparm. * config/i386/i386.opt: New target option -msseregparm.
......
...@@ -292,7 +292,7 @@ typedef struct basic_block_def *basic_block; ...@@ -292,7 +292,7 @@ typedef struct basic_block_def *basic_block;
All other flags may be cleared by clear_bb_flags(). It is generally 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. */ a bad idea to rely on any flags being up-to-date. */
enum enum bb_flags
{ {
/* Set if insns in BB have are modified. Used for updating liveness info. */ /* Set if insns in BB have are modified. Used for updating liveness info. */
...@@ -325,7 +325,15 @@ enum ...@@ -325,7 +325,15 @@ enum
BB_DUPLICATED = 256, BB_DUPLICATED = 256,
/* Set on blocks that are in RTL format. */ /* Set on blocks that are in RTL format. */
BB_RTL = 1024 BB_RTL = 1024,
/* Set on blocks that are forwarder blocks.
Only used in cfgcleanup.c. */
BB_FORWARDER_BLOCK = 2048,
/* Set on blocks that cannot be threaded through.
Only used in cfgcleanup.c. */
BB_NONTHREADABLE_BLOCK = 4096
}; };
/* Dummy flag for convenience in the hot/cold partitioning code. */ /* Dummy flag for convenience in the hot/cold partitioning code. */
......
...@@ -54,24 +54,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -54,24 +54,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#include "cfgloop.h" #include "cfgloop.h"
#include "expr.h" #include "expr.h"
/* cleanup_cfg maintains following flags for each basic block. */ #define FORWARDER_BLOCK_P(BB) ((BB)->flags & BB_FORWARDER_BLOCK)
enum bb_flags
{
/* Set if BB is the forwarder block to avoid too many
forwarder_block_p calls. */
BB_FORWARDER_BLOCK = 1,
BB_NONTHREADABLE_BLOCK = 2
};
#define BB_FLAGS(BB) (enum bb_flags) (BB)->aux
#define BB_SET_FLAG(BB, FLAG) \
(BB)->aux = (void *) (long) ((enum bb_flags) (BB)->aux | (FLAG))
#define BB_CLEAR_FLAG(BB, FLAG) \
(BB)->aux = (void *) (long) ((enum bb_flags) (BB)->aux & ~(FLAG))
#define FORWARDER_BLOCK_P(BB) (BB_FLAGS (BB) & BB_FORWARDER_BLOCK)
/* Set to true when we are running first pass of try_optimize_cfg loop. */ /* Set to true when we are running first pass of try_optimize_cfg loop. */
static bool first_pass; static bool first_pass;
static bool try_crossjump_to_edge (int, edge, edge); static bool try_crossjump_to_edge (int, edge, edge);
...@@ -101,7 +85,7 @@ notice_new_block (basic_block bb) ...@@ -101,7 +85,7 @@ notice_new_block (basic_block bb)
return; return;
if (forwarder_block_p (bb)) if (forwarder_block_p (bb))
BB_SET_FLAG (bb, BB_FORWARDER_BLOCK); bb->flags |= BB_FORWARDER_BLOCK;
} }
/* Recompute forwarder flag after block has been modified. */ /* Recompute forwarder flag after block has been modified. */
...@@ -110,9 +94,9 @@ static void ...@@ -110,9 +94,9 @@ static void
update_forwarder_flag (basic_block bb) update_forwarder_flag (basic_block bb)
{ {
if (forwarder_block_p (bb)) if (forwarder_block_p (bb))
BB_SET_FLAG (bb, BB_FORWARDER_BLOCK); bb->flags |= BB_FORWARDER_BLOCK;
else else
BB_CLEAR_FLAG (bb, BB_FORWARDER_BLOCK); bb->flags &= ~BB_FORWARDER_BLOCK;
} }
/* Simplify a conditional jump around an unconditional jump. /* Simplify a conditional jump around an unconditional jump.
...@@ -285,7 +269,7 @@ thread_jump (int mode, edge e, basic_block b) ...@@ -285,7 +269,7 @@ thread_jump (int mode, edge e, basic_block b)
bool failed = false; bool failed = false;
reg_set_iterator rsi; reg_set_iterator rsi;
if (BB_FLAGS (b) & BB_NONTHREADABLE_BLOCK) if (b->flags & BB_NONTHREADABLE_BLOCK)
return NULL; return NULL;
/* At the moment, we do handle only conditional jumps, but later we may /* At the moment, we do handle only conditional jumps, but later we may
...@@ -294,7 +278,7 @@ thread_jump (int mode, edge e, basic_block b) ...@@ -294,7 +278,7 @@ thread_jump (int mode, edge e, basic_block b)
return NULL; return NULL;
if (EDGE_COUNT (b->succs) != 2) if (EDGE_COUNT (b->succs) != 2)
{ {
BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK); b->flags |= BB_NONTHREADABLE_BLOCK;
return NULL; return NULL;
} }
...@@ -304,7 +288,7 @@ thread_jump (int mode, edge e, basic_block b) ...@@ -304,7 +288,7 @@ thread_jump (int mode, edge e, basic_block b)
if (!any_condjump_p (BB_END (b)) || !onlyjump_p (BB_END (b))) if (!any_condjump_p (BB_END (b)) || !onlyjump_p (BB_END (b)))
{ {
BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK); b->flags |= BB_NONTHREADABLE_BLOCK;
return NULL; return NULL;
} }
...@@ -342,7 +326,7 @@ thread_jump (int mode, edge e, basic_block b) ...@@ -342,7 +326,7 @@ thread_jump (int mode, edge e, basic_block b)
insn = NEXT_INSN (insn)) insn = NEXT_INSN (insn))
if (INSN_P (insn) && side_effects_p (PATTERN (insn))) if (INSN_P (insn) && side_effects_p (PATTERN (insn)))
{ {
BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK); b->flags |= BB_NONTHREADABLE_BLOCK;
return NULL; return NULL;
} }
...@@ -386,7 +370,7 @@ thread_jump (int mode, edge e, basic_block b) ...@@ -386,7 +370,7 @@ thread_jump (int mode, edge e, basic_block b)
have life information in cfg_cleanup. */ have life information in cfg_cleanup. */
if (failed) if (failed)
{ {
BB_SET_FLAG (b, BB_NONTHREADABLE_BLOCK); b->flags |= BB_NONTHREADABLE_BLOCK;
goto failed_exit; goto failed_exit;
} }
...@@ -612,7 +596,7 @@ try_forward_edges (int mode, basic_block b) ...@@ -612,7 +596,7 @@ try_forward_edges (int mode, basic_block b)
/ REG_BR_PROB_BASE); / REG_BR_PROB_BASE);
if (!FORWARDER_BLOCK_P (b) && forwarder_block_p (b)) if (!FORWARDER_BLOCK_P (b) && forwarder_block_p (b))
BB_SET_FLAG (b, BB_FORWARDER_BLOCK); b->flags |= BB_FORWARDER_BLOCK;
do do
{ {
...@@ -1837,12 +1821,12 @@ try_optimize_cfg (int mode) ...@@ -1837,12 +1821,12 @@ try_optimize_cfg (int mode)
if (mode & CLEANUP_CROSSJUMP) if (mode & CLEANUP_CROSSJUMP)
add_noreturn_fake_exit_edges (); add_noreturn_fake_exit_edges ();
FOR_EACH_BB (bb)
update_forwarder_flag (bb);
if (mode & (CLEANUP_UPDATE_LIFE | CLEANUP_CROSSJUMP | CLEANUP_THREADING)) if (mode & (CLEANUP_UPDATE_LIFE | CLEANUP_CROSSJUMP | CLEANUP_THREADING))
clear_bb_flags (); clear_bb_flags ();
FOR_EACH_BB (bb)
update_forwarder_flag (bb);
if (! targetm.cannot_modify_jumps_p ()) if (! targetm.cannot_modify_jumps_p ())
{ {
first_pass = true; first_pass = true;
...@@ -2029,7 +2013,8 @@ try_optimize_cfg (int mode) ...@@ -2029,7 +2013,8 @@ try_optimize_cfg (int mode)
if (mode & CLEANUP_CROSSJUMP) if (mode & CLEANUP_CROSSJUMP)
remove_fake_exit_edges (); remove_fake_exit_edges ();
clear_aux_for_blocks (); FOR_ALL_BB (b)
b->flags &= ~(BB_FORWARDER_BLOCK | BB_NONTHREADABLE_BLOCK);
return changed_overall; return changed_overall;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment