SSA CCP minor cleanups
law@redhat.com
law@redhat.com
Tue Jul 10 09:28:00 GMT 2001
Just some minor cleanups. Some were from David Billinghurst, some are
my own.
Bootstrapped x86-linux.
* ssa-ccp.c (first_phi_node): Remove. Replace uses with calls to
first_insn_after_basic_block_note instead.
* df.c (df_bb_refs_unlink): #if 0 out for now.
* ssa.h: Add prototype for ssa_const_prop
* ssa-ccp.c: Add prototype for ssa_fast_dce and mark_references
(ssa_ccp_substitute_constants): Fix signed vs unsigned comparison
(ssa_fast_dce): Remove unused variable
Index: ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ssa-ccp.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 ssa-ccp.c
*** ssa-ccp.c 2001/07/09 19:47:27 1.1
--- ssa-ccp.c 2001/07/10 16:24:14
*************** static sbitmap ssa_edges;
*** 123,164 ****
#define PHI_PARMS(x) XVEC (SET_SRC (x), 0)
#define EIE(x,y) EDGE_INDEX (edges, x, y)
- rtx first_phi_node PARAMS ((basic_block));
static void visit_phi_node PARAMS ((rtx, basic_block));
static void visit_expression PARAMS ((rtx, basic_block));
static void defs_to_undefined PARAMS ((rtx));
static void defs_to_varying PARAMS ((rtx));
static void examine_flow_edges PARAMS ((void));
static void follow_def_use_chains PARAMS ((void));
static void optimize_unexecutable_edges PARAMS ((struct edge_list *, sbitmap));
static void ssa_ccp_substitute_constants PARAMS ((void));
static void ssa_ccp_df_delete_unreachable_insns PARAMS ((void));
- /* Return the first PHI node in a basic block. This routine knows
- what INSNs can start a basic block and what can validly follow
- them up to the first PHI node.
-
- If the INSN chain or block structures are incorrect, then the behavior
- of this routine is undefined. verify_flow_info will normally catch
- these problems in a more graceful manner. */
- rtx
- first_phi_node (block)
- basic_block block;
- {
- rtx insn = block->head;
-
- /* Eat the optional CODE_LABEL at the start of the block. */
- if (GET_CODE (insn) == CODE_LABEL)
- insn = NEXT_INSN (insn);
-
- /* Eat the mandatory NOTE_INSN_BASIC_BLOCK. */
- if (!NOTE_INSN_BASIC_BLOCK_P (insn) || NOTE_BASIC_BLOCK (insn) != block)
- abort ();
-
- /* If there is a PHI node in this block, then it will be the next insn. */
- return NEXT_INSN (insn);
- }
-
/* Loop through the PHI_NODE's parameters for BLOCK and compare their
lattice values to determine PHI_NODE's lattice value. */
static void
--- 123,140 ----
#define PHI_PARMS(x) XVEC (SET_SRC (x), 0)
#define EIE(x,y) EDGE_INDEX (edges, x, y)
static void visit_phi_node PARAMS ((rtx, basic_block));
static void visit_expression PARAMS ((rtx, basic_block));
static void defs_to_undefined PARAMS ((rtx));
static void defs_to_varying PARAMS ((rtx));
static void examine_flow_edges PARAMS ((void));
+ static int mark_references PARAMS ((rtx *, void *));
static void follow_def_use_chains PARAMS ((void));
static void optimize_unexecutable_edges PARAMS ((struct edge_list *, sbitmap));
static void ssa_ccp_substitute_constants PARAMS ((void));
static void ssa_ccp_df_delete_unreachable_insns PARAMS ((void));
+ static void ssa_fast_dce PARAMS ((struct df *));
/* Loop through the PHI_NODE's parameters for BLOCK and compare their
lattice values to determine PHI_NODE's lattice value. */
static void
*************** examine_flow_edges (void)
*** 638,644 ****
/* Always simulate PHI nodes, even if we have simulated this block
before. Note that all PHI nodes are consecutive within a block. */
! for (curr_phi_node = first_phi_node (succ_block);
PHI_NODE_P (curr_phi_node);
curr_phi_node = NEXT_INSN (curr_phi_node))
visit_phi_node (curr_phi_node, succ_block);
--- 614,620 ----
/* Always simulate PHI nodes, even if we have simulated this block
before. Note that all PHI nodes are consecutive within a block. */
! for (curr_phi_node = first_insn_after_basic_block_note (succ_block);
PHI_NODE_P (curr_phi_node);
curr_phi_node = NEXT_INSN (curr_phi_node))
visit_phi_node (curr_phi_node, succ_block);
*************** optimize_unexecutable_edges (edges, exec
*** 751,757 ****
the PHI nodes in the target block. */
if (edge->dest != EXIT_BLOCK_PTR)
{
! rtx insn = first_phi_node (edge->dest);
while (PHI_NODE_P (insn))
{
--- 727,733 ----
the PHI nodes in the target block. */
if (edge->dest != EXIT_BLOCK_PTR)
{
! rtx insn = first_insn_after_basic_block_note (edge->dest);
while (PHI_NODE_P (insn))
{
*************** optimize_unexecutable_edges (edges, exec
*** 840,846 ****
static void
ssa_ccp_substitute_constants ()
{
! int i;
for (i = FIRST_PSEUDO_REGISTER; i < VARRAY_SIZE (ssa_definition); i++)
{
--- 816,822 ----
static void
ssa_ccp_substitute_constants ()
{
! unsigned int i;
for (i = FIRST_PSEUDO_REGISTER; i < VARRAY_SIZE (ssa_definition); i++)
{
*************** ssa_fast_dce (df)
*** 1159,1166 ****
found_use = 0;
for (curruse = df->regs[reg].uses; curruse; curruse = curruse->next)
{
- rtx useinsn;
-
if (curruse->ref
&& DF_REF_INSN (curruse->ref)
&& ! INSN_DELETED_P (DF_REF_INSN (curruse->ref))
--- 1135,1140 ----
Index: df.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/df.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 df.c
*** df.c 2001/06/28 22:11:18 1.2
--- df.c 2001/07/10 16:24:19
*************** static struct df_link *df_ref_unlink PAR
*** 218,225 ****
static void df_def_unlink PARAMS((struct df *, struct ref *));
static void df_use_unlink PARAMS((struct df *, struct ref *));
static void df_insn_refs_unlink PARAMS ((struct df *, basic_block, rtx));
- static void df_bb_refs_unlink PARAMS ((struct df *, basic_block));
#if 0
static void df_refs_unlink PARAMS ((struct df *, bitmap));
#endif
--- 218,225 ----
static void df_def_unlink PARAMS((struct df *, struct ref *));
static void df_use_unlink PARAMS((struct df *, struct ref *));
static void df_insn_refs_unlink PARAMS ((struct df *, basic_block, rtx));
#if 0
+ static void df_bb_refs_unlink PARAMS ((struct df *, basic_block));
static void df_refs_unlink PARAMS ((struct df *, bitmap));
#endif
*************** df_insn_refs_unlink (df, bb, insn)
*** 2513,2518 ****
--- 2513,2519 ----
}
+ #if 0
/* Unlink all the insns within BB from their reference information. */
static void
df_bb_refs_unlink (df, bb)
*************** df_bb_refs_unlink (df, bb)
*** 2535,2541 ****
}
- #if 0
/* Unlink all the refs in the basic blocks specified by BLOCKS.
Not currently used. */
static void
--- 2536,2541 ----
Index: ssa.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ssa.h,v
retrieving revision 1.4
diff -c -3 -p -r1.4 ssa.h
*** ssa.h 2001/06/29 20:35:53 1.4
--- ssa.h 2001/07/10 16:24:19
*************** extern int remove_phi_alternative PARAMS
*** 35,40 ****
--- 35,44 ----
/* In ssa-dce.c */
extern void ssa_eliminate_dead_code PARAMS ((void));
+ /* In ssa-ccp.c */
+ extern void ssa_const_prop PARAMS ((void));
+
+
/* SSA definitions and uses. */
/* This flag is set when the CFG is in SSA form. */
extern int in_ssa_form;
More information about the Gcc-patches
mailing list