This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Minor SSA cleanups
- To: gcc-patches at gcc dot gnu dot org
- Subject: Minor SSA cleanups
- From: Jeffrey A Law <law at localhost dot localdomain>
- Date: Tue, 19 Jun 2001 09:47:56 -0700
- Reply-to: law at redhat dot com
We want remove_phi_alternative to have external scope so that SSA optimizers
which remove unexecutable edges can also remove phi alternatives. We're
also going to be changing the PHI nodes to record block pointers rather
than block indices (but that'll be a separate patch).
It's also rather silly to have flow.c remove dead code when we're going to
have a very fast SSA DCE to do that for us :-)
For the mainline only, of course.
* ssa.c (remove_phi_alternative): Remove declaration. No longer
static. Second argument is a pointer to a basic block structure,
not a basic block index.
(convert_to_ssa): Do not remove dead code.
(convert_from_ssa): Do not remove dead code to create death notes.
* ssa.h (remove_phi_alternative): Declare.
Index: ssa.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ssa.c,v
retrieving revision 1.27
diff -c -3 -p -r1.27 ssa.c
*** ssa.c 2001/06/19 14:18:49 1.27
--- ssa.c 2001/06/19 16:42:19
***************
*** 1,5 ****
/* Static Single Assignment conversion routines for the GNU compiler.
! Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
--- 1,5 ----
/* Static Single Assignment conversion routines for the GNU compiler.
! Copyright (C) 2000, 2001 Free Software Foundation, Inc.
This file is part of GNU CC.
*************** static inline rtx * phi_alternative
*** 164,171 ****
PARAMS ((rtx, int));
static rtx first_insn_after_basic_block_note
PARAMS ((basic_block));
- static int remove_phi_alternative
- PARAMS ((rtx, int));
static void compute_dominance_frontiers_1
PARAMS ((sbitmap *frontiers, int *idom, int bb, sbitmap done));
static void compute_dominance_frontiers
--- 164,169 ----
*************** phi_alternative (set, c)
*** 427,436 ****
block C. Return non-zero on success, or zero if no alternative is
found for C. */
! static int
! remove_phi_alternative (set, c)
rtx set;
! int c;
{
rtvec phi_vec = XVEC (SET_SRC (set), 0);
int num_elem = GET_NUM_ELEM (phi_vec);
--- 425,434 ----
block C. Return non-zero on success, or zero if no alternative is
found for C. */
! int
! remove_phi_alternative (set, block)
rtx set;
! basic_block block;
{
rtvec phi_vec = XVEC (SET_SRC (set), 0);
int num_elem = GET_NUM_ELEM (phi_vec);
*************** convert_to_ssa ()
*** 1155,1162 ****
if (in_ssa_form)
abort ();
! /* Need global_live_at_{start,end} up to date. */
! life_analysis (get_insns (), NULL, PROP_KILL_DEAD_CODE |
PROP_SCAN_DEAD_CODE);
idom = (int *) alloca (n_basic_blocks * sizeof (int));
memset ((void *)idom, -1, (size_t)n_basic_blocks * sizeof (int));
--- 1153,1161 ----
if (in_ssa_form)
abort ();
! /* Need global_live_at_{start,end} up to date. Do not remove any
! dead code. We'll let the SSA optimizers do that. */
! life_analysis (get_insns (), NULL, 0);
idom = (int *) alloca (n_basic_blocks * sizeof (int));
memset ((void *)idom, -1, (size_t)n_basic_blocks * sizeof (int));
*************** convert_from_ssa()
*** 2148,2157 ****
int bb;
partition reg_partition;
rtx insns = get_insns ();
! /* Need global_live_at_{start,end} up to date. */
! life_analysis (insns, NULL,
! PROP_KILL_DEAD_CODE | PROP_SCAN_DEAD_CODE | PROP_DEATH_NOTES);
/* Figure out which regs in copies and phi nodes don't conflict and
therefore can be coalesced. */
--- 2147,2159 ----
int bb;
partition reg_partition;
rtx insns = get_insns ();
+
+ /* Need global_live_at_{start,end} up to date. There should not be
+ any significant dead code at this point, except perhaps dead
+ stores. So do not take the time to perform dead code elimination.
! We also do not need death notes, so don't bother creating them. */
! life_analysis (insns, NULL, 0);
/* Figure out which regs in copies and phi nodes don't conflict and
therefore can be coalesced. */
Index: ssa.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/ssa.h,v
retrieving revision 1.1
diff -c -3 -p -r1.1 ssa.h
*** ssa.h 2000/08/02 04:21:27 1.1
--- ssa.h 2001/06/19 16:42:19
***************
*** 1,5 ****
/* Static Single Assignment (SSA) definitions for GNU C-Compiler
! Copyright (C) 2000 Free Software Foundation, Inc.
Written by Jeffrey D. Oldham <oldham@codesourcery.com>.
This file is part of GNU CC.
--- 1,5 ----
/* Static Single Assignment (SSA) definitions for GNU C-Compiler
! Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Written by Jeffrey D. Oldham <oldham@codesourcery.com>.
This file is part of GNU CC.
*************** typedef int (*successor_phi_fn)
*** 27,35 ****
extern int for_each_successor_phi PARAMS ((basic_block bb,
successor_phi_fn,
void *));
/* Optimizations. */
! /* In dce.c */
extern void eliminate_dead_code PARAMS ((void));
/* SSA definitions and uses. */
--- 27,37 ----
extern int for_each_successor_phi PARAMS ((basic_block bb,
successor_phi_fn,
void *));
+ extern int remove_phi_alternative PARAMS ((rtx, basic_block));
+
/* Optimizations. */
! /* In ssa-dce.c */
extern void eliminate_dead_code PARAMS ((void));
/* SSA definitions and uses. */