aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorGeoff Keating <geoffk@cygnus.com>2000-08-02 00:53:59 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2000-08-02 00:53:59 +0000
commit8cd8f856b33bbd6c6627eb0a18e34b046e2163f1 (patch)
tree51e7cfa73194f407e18d5c607f8f9f28b8c01196 /gcc
parent7d17b34de55c8cd8d83581036f8e87fae492db13 (diff)
downloadgcc-8cd8f856b33bbd6c6627eb0a18e34b046e2163f1.zip
gcc-8cd8f856b33bbd6c6627eb0a18e34b046e2163f1.tar.gz
gcc-8cd8f856b33bbd6c6627eb0a18e34b046e2163f1.tar.bz2
rtl.h (enum reg_note): Add REG_MAYBE_DEAD.
* rtl.h (enum reg_note): Add REG_MAYBE_DEAD. * rtl.c (reg_note_name): Add REG_MAYBE_DEAD. * flow.c (propagate_one_insn): Allow deletion of prologue/epilogue insns if they have a REG_MAYBE_DEAD note attached. * config/rs6000/rs6000.c (rs6000_maybe_dead): New function. (rs6000_emit_load_toc_table): TOC loads may go dead. From-SVN: r35414
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/rs6000/rs6000.c46
-rw-r--r--gcc/flow.c3
-rw-r--r--gcc/rtl.c2
-rw-r--r--gcc/rtl.h8
5 files changed, 50 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2f9c4a6..b456697 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2000-08-01 Geoff Keating <geoffk@cygnus.com>
+
+ * rtl.h (enum reg_note): Add REG_MAYBE_DEAD.
+ * rtl.c (reg_note_name): Add REG_MAYBE_DEAD.
+ * flow.c (propagate_one_insn): Allow deletion of prologue/epilogue
+ insns if they have a REG_MAYBE_DEAD note attached.
+ * config/rs6000/rs6000.c (rs6000_maybe_dead): New function.
+ (rs6000_emit_load_toc_table): TOC loads may go dead.
+
2000-08-01 Jim Wilson <wilson@cygnus.com>
* config/ia64/ia64.c (ia64_function_arg): Fix last change. Verify
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 7644606..67ff693 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -4819,6 +4819,16 @@ debug_stack_info (info)
fprintf (stderr, "\n");
}
+/* Add a REG_MAYBE_DEAD note to the insn. */
+static void
+rs6000_maybe_dead (insn)
+ rtx insn;
+{
+ REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD,
+ const0_rtx,
+ REG_NOTES (insn));
+}
+
/* Emit instructions needed to load the TOC register.
This is only needed when TARGET_TOC, TARGET_MINIMAL_TOC, and there is
a constant pool; or for SVR4 -fpic. */
@@ -4839,10 +4849,10 @@ rs6000_emit_load_toc_table (fromprolog)
? gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM)
: gen_reg_rtx (Pmode));
if (TARGET_32BIT)
- emit_insn (gen_load_toc_v4_pic_si (temp));
+ rs6000_maybe_dead (emit_insn (gen_load_toc_v4_pic_si (temp)));
else
- emit_insn (gen_load_toc_v4_pic_di (temp));
- emit_move_insn (dest, temp);
+ rs6000_maybe_dead (emit_insn (gen_load_toc_v4_pic_di (temp)));
+ rs6000_maybe_dead (emit_move_insn (dest, temp));
}
else if (flag_pic == 2)
{
@@ -4872,9 +4882,12 @@ rs6000_emit_load_toc_table (fromprolog)
ASM_GENERATE_INTERNAL_LABEL (buf, "LCL", rs6000_pic_labelno);
symL = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
- emit_insn (gen_load_toc_v4_PIC_1 (tempLR, symF));
- emit_move_insn (dest, tempLR);
- emit_insn (gen_load_toc_v4_PIC_2 (temp0, dest, symL, symF));
+ rs6000_maybe_dead (emit_insn (gen_load_toc_v4_PIC_1 (tempLR,
+ symF)));
+ rs6000_maybe_dead (emit_move_insn (dest, tempLR));
+ rs6000_maybe_dead (emit_insn (gen_load_toc_v4_PIC_2 (temp0, dest,
+ symL,
+ symF)));
}
else
{
@@ -4887,11 +4900,14 @@ rs6000_emit_load_toc_table (fromprolog)
ASM_GENERATE_INTERNAL_LABEL (buf, "LCG", reload_toc_labelno++);
symF = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
- emit_insn (gen_load_toc_v4_PIC_1b (tempLR, symF, tocsym));
- emit_move_insn (dest, tempLR);
- emit_move_insn (temp0, gen_rtx_MEM (Pmode, dest));
+ rs6000_maybe_dead (emit_insn (gen_load_toc_v4_PIC_1b (tempLR,
+ symF,
+ tocsym)));
+ rs6000_maybe_dead (emit_move_insn (dest, tempLR));
+ rs6000_maybe_dead (emit_move_insn (temp0,
+ gen_rtx_MEM (Pmode, dest)));
}
- emit_insn (gen_addsi3 (dest, temp0, dest));
+ rs6000_maybe_dead (emit_insn (gen_addsi3 (dest, temp0, dest)));
}
else if (flag_pic == 0 && TARGET_MINIMAL_TOC)
{
@@ -4901,8 +4917,8 @@ rs6000_emit_load_toc_table (fromprolog)
ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1);
realsym = gen_rtx_SYMBOL_REF (Pmode, ggc_alloc_string (buf, -1));
- emit_insn (gen_elf_high (dest, realsym));
- emit_insn (gen_elf_low (dest, dest, realsym));
+ rs6000_maybe_dead (emit_insn (gen_elf_high (dest, realsym)));
+ rs6000_maybe_dead (emit_insn (gen_elf_low (dest, dest, realsym)));
}
else
abort();
@@ -4910,9 +4926,9 @@ rs6000_emit_load_toc_table (fromprolog)
else
{
if (TARGET_32BIT)
- emit_insn (gen_load_toc_aix_si (dest));
+ rs6000_maybe_dead (emit_insn (gen_load_toc_aix_si (dest)));
else
- emit_insn (gen_load_toc_aix_di (dest));
+ rs6000_maybe_dead (emit_insn (gen_load_toc_aix_di (dest)));
}
}
@@ -4939,7 +4955,7 @@ uses_TOC ()
rtx pat = PATTERN (insn);
int i;
- if (GET_CODE(pat) == PARALLEL)
+ if (GET_CODE (pat) == PARALLEL)
for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
if (GET_CODE (XVECEXP (PATTERN (insn), 0, i)) == UNSPEC
&& XINT (XVECEXP (PATTERN (insn), 0, i), 1) == 7)
diff --git a/gcc/flow.c b/gcc/flow.c
index 373e236..688e256 100644
--- a/gcc/flow.c
+++ b/gcc/flow.c
@@ -3428,7 +3428,8 @@ propagate_one_insn (pbi, insn)
&& (((HAVE_epilogue || HAVE_prologue)
&& prologue_epilogue_contains (insn))
|| (HAVE_sibcall_epilogue
- && sibcall_epilogue_contains (insn))))
+ && sibcall_epilogue_contains (insn)))
+ && find_reg_note (insn, REG_MAYBE_DEAD, NULL_RTX) == 0)
{
if (flags & PROP_KILL_DEAD_CODE)
{
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 91b38cb..dedb38a 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -258,7 +258,7 @@ const char * const reg_note_name[] =
"REG_LABEL", "REG_DEP_ANTI", "REG_DEP_OUTPUT", "REG_BR_PROB",
"REG_EXEC_COUNT", "REG_NOALIAS", "REG_SAVE_AREA", "REG_BR_PRED",
"REG_FRAME_RELATED_EXPR", "REG_EH_CONTEXT", "REG_EH_REGION",
- "REG_EH_RETHROW", "REG_SAVE_NOTE"
+ "REG_EH_RETHROW", "REG_SAVE_NOTE", "REG_MAYBE_DEAD"
};
static void fatal_with_file_and_line PARAMS ((FILE *, const char *, ...))
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 24102a9..b96c53f 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -515,7 +515,13 @@ enum reg_note
REG_EH_RETHROW,
/* Used by haifa-sched to save NOTE_INSN notes across scheduling. */
- REG_SAVE_NOTE
+ REG_SAVE_NOTE,
+
+ /* Indicates that this insn (which is part of the prologue) computes
+ a value which might not be used later, and if so it's OK to delete
+ the insn. Normally, deleting any insn in the prologue is an error.
+ At present the parameter is unused and set to (const_int 0). */
+ REG_MAYBE_DEAD
};
/* The base value for branch probability notes. */