aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorJeffrey Oldham <oldham@codesourcery.com>2000-08-02 04:21:27 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-08-02 04:21:27 +0000
commitb53978a3ee3998863c0f942b9b4c40d0e36d2bc7 (patch)
treeeffa31090707b8e4d80bb9f56140fd2884c53bc1 /gcc/toplev.c
parent79c2c6da2c5621208eec12f608b672856d38f6a3 (diff)
downloadgcc-b53978a3ee3998863c0f942b9b4c40d0e36d2bc7.zip
gcc-b53978a3ee3998863c0f942b9b4c40d0e36d2bc7.tar.gz
gcc-b53978a3ee3998863c0f942b9b4c40d0e36d2bc7.tar.bz2
Makefile.in (OBJS): Added dce.o.
* Makefile.in (OBJS): Added dce.o. (ssa.o): Updated target to include ssa.h. (flow.o): Likewise. (toplev.o): Likewise. (dce.o): Created target. * basic-block.h: Added comments. (INVALID_BLOCK): Added definition. (connect_infinite_loops_to_exit): Added declaration. Moved SSA declarations to ssa.h. * flow.c: Added inclusion of ssa.h. (struct depth_first_search_dsS, depth_first_search_ds): Added definitions. (compute_immediate_postdominators): Added definition. (connect_infinite_loops_to_exit): Likewise. (flow_dfs_compute_reverse_init): Likewise. (flow_dfs_compute_reverse_add_bb): Likewise. (flow_dfs_compute_reverse_execute): Likewise. (flow_dfs_compute_reverse_finish): Likewise. * rtl.h (rtx/in_struct): Added use to determine insn necessity. (LABEL_P): Added definition. (JUMP_P): Likewise. (NOTE_P): Likewise. (BARRIER_P): Likewise. (JUMP_TABLE_DATA_P): Likewise. (INSN_DEAD_CODE_P): Likewise. * ssa.c: Replaced inclusions with ssa.h inclusion. (CONVERT_HARD_REGISTER_TO_SSA_P): Moved to ssa.h. (rename_registers): Removed unnecessary variables. * ssa.h: Created by moving declarations from ssa.c and basic-block.h. * timevar.def: Defined TV_DEAD_CODE_ELIM. * toplev.c: Added ssa.h inclusion. (dump_file_index): Added DFI_dce. (dump_file): Added "dce" entry. Defined flag_ssa. (f_options): Added dce entry. * invoke.texi: Document -fdce. Emphasize experimental status of -fssa. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r35419
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index fde14d1..b13e580 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -63,6 +63,7 @@ Boston, MA 02111-1307, USA. */
#include "regs.h"
#include "timevar.h"
#include "diagnostic.h"
+#include "ssa.h"
#ifndef ACCUMULATE_OUTGOING_ARGS
#define ACCUMULATE_OUTGOING_ARGS 0
@@ -259,6 +260,7 @@ enum dump_file_index
DFI_cse,
DFI_addressof,
DFI_ssa,
+ DFI_dce,
DFI_ussa,
DFI_gcse,
DFI_loop,
@@ -291,7 +293,7 @@ enum dump_file_index
Remaining -d letters:
" h o q u "
- " H K OPQ TUVWXYZ"
+ " H K OPQ TUVW YZ"
*/
struct dump_file_info dump_file[DFI_MAX] =
@@ -302,6 +304,7 @@ struct dump_file_info dump_file[DFI_MAX] =
{ "cse", 's', 0, 0, 0 },
{ "addressof", 'F', 0, 0, 0 },
{ "ssa", 'e', 1, 0, 0 },
+ { "dce", 'X', 1, 0, 0 },
{ "ussa", 'e', 1, 0, 0 }, /* Yes, duplicate enable switch. */
{ "gcse", 'G', 1, 0, 0 },
{ "loop", 'L', 1, 0, 0 },
@@ -786,6 +789,9 @@ int flag_gnu_linker = 1;
/* Enable SSA. */
int flag_ssa = 0;
+/* Enable dead code elimination. */
+int flag_dce = 0;
+
/* Tag all structures with __attribute__(packed) */
int flag_pack_struct = 0;
@@ -1094,6 +1100,8 @@ lang_independent_options f_options[] =
"Instrument function entry/exit with profiling calls"},
{"ssa", &flag_ssa, 1,
"Enable SSA optimizations" },
+ {"dce", &flag_dce, 1,
+ "Enable dead code elimination" },
{"leading-underscore", &flag_leading_underscore, 1,
"External symbols have a leading underscore" },
{"ident", &flag_no_ident, 0,
@@ -2976,13 +2984,25 @@ rest_of_compilation (decl)
close_dump_file (DFI_ssa, print_rtl_with_bb, insns);
timevar_pop (TV_TO_SSA);
- /* Currently, there's nothing to do in SSA form. */
-
/* The SSA implementation uses basic block numbers in its phi
nodes. Thus, changing the control-flow graph or the basic
blocks, e.g., calling find_basic_blocks () or cleanup_cfg (),
may cause problems. */
+ if (flag_dce)
+ {
+ /* Remove dead code. */
+
+ timevar_push (TV_DEAD_CODE_ELIM);
+ open_dump_file (DFI_dce, decl);
+
+ insns = get_insns ();
+ eliminate_dead_code();
+
+ close_dump_file (DFI_dce, print_rtl_with_bb, insns);
+ timevar_pop (TV_DEAD_CODE_ELIM);
+ }
+
/* Convert from SSA form. */
timevar_push (TV_FROM_SSA);