From 6153f5f091eb6d94816fc1b84a63763c438f8717 Mon Sep 17 00:00:00 2001 From: law Date: Sat, 28 Apr 2001 16:53:00 +0000 Subject: [PATCH] * flow.c (propagate_block_delete_insn): Handle deletion of ADDR_VEC and ADDR_DIFF_VEC insns when the proceeding CODE_LABEL was put into the constant pool. * jump.c (jump_optimize_1): Remove barrier successors after all the LABEL_NUSES counds have been computed. (delete_barrier_successors): When deleting a tablejump insn, also delete the jump table it uses. * varasm.c (force_const_mem): Set LABEL_PRESERVE_P when forcing a label into memory. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41662 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++++++++++ gcc/flow.c | 5 ++++- gcc/jump.c | 25 +++++++++++++++++++++---- gcc/varasm.c | 3 +++ 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 496611d..3c47113 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +Sat Apr 28 10:36:23 2001 Jeffrey A Law (law@cygnus.com) + + * flow.c (propagate_block_delete_insn): Handle deletion of ADDR_VEC + and ADDR_DIFF_VEC insns when the proceeding CODE_LABEL was put + into the constant pool. + * jump.c (jump_optimize_1): Remove barrier successors after all + the LABEL_NUSES counds have been computed. + (delete_barrier_successors): When deleting a tablejump insn, also + delete the jump table it uses. + * varasm.c (force_const_mem): Set LABEL_PRESERVE_P when forcing a + label into memory. + 2001-04-28 Martin Kalen * pa.c (FRP): Remove erroneous white space in macro definition. diff --git a/gcc/flow.c b/gcc/flow.c index a4b334d..96d2ad0 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -3638,7 +3638,10 @@ propagate_block_delete_insn (bb, insn) rtx label = XEXP (inote, 0); rtx next; - if (LABEL_NUSES (label) == 1 + /* The label may be forced if it has been put in the constant + pool. If that is the only use we must discard the table + jump following it, but not the label itself. */ + if (LABEL_NUSES (label) == 1 + LABEL_PRESERVE_P (label) && (next = next_nonnote_insn (label)) != NULL && GET_CODE (next) == JUMP_INSN && (GET_CODE (PATTERN (next)) == ADDR_VEC diff --git a/gcc/jump.c b/gcc/jump.c index e3ed1b4..4046b9a 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -214,9 +214,6 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, cross_jump_death_matters = (cross_jump == 2); max_uid = init_label_info (f) + 1; - if (! mark_labels_only) - delete_barrier_successors (f); - /* Leave some extra room for labels and duplicate exit test insns we make. */ max_jump_chain = max_uid * 14 / 10; @@ -239,6 +236,9 @@ jump_optimize_1 (f, cross_jump, noop_moves, after_regscan, if (GET_CODE (XEXP (insn, 0)) == CODE_LABEL) LABEL_NUSES (XEXP (insn, 0))++; + if (! mark_labels_only) + delete_barrier_successors (f); + /* Quit now if we just wanted to rebuild the JUMP_LABEL and REG_LABEL notes and recompute LABEL_NUSES. */ if (mark_labels_only) @@ -792,7 +792,24 @@ delete_barrier_successors (f) while (insn != 0 && GET_CODE (insn) != CODE_LABEL) { - if (GET_CODE (insn) == NOTE + if (GET_CODE (insn) == JUMP_INSN) + { + /* Detect when we're deleting a tablejump; get rid of + the jump table as well. */ + rtx next1 = next_nonnote_insn (insn); + rtx next2 = next1 ? next_nonnote_insn (next1) : 0; + if (next2 && GET_CODE (next1) == CODE_LABEL + && GET_CODE (next2) == JUMP_INSN + && (GET_CODE (PATTERN (next2)) == ADDR_VEC + || GET_CODE (PATTERN (next2)) == ADDR_DIFF_VEC)) + { + delete_insn (insn); + insn = next2; + } + else + insn = delete_insn (insn); + } + else if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) != NOTE_INSN_FUNCTION_END) insn = NEXT_INSN (insn); else diff --git a/gcc/varasm.c b/gcc/varasm.c index a803fe1..86f2e4f 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -3589,6 +3589,9 @@ force_const_mem (mode, x) pool_offset += align - 1; pool_offset &= ~ (align - 1); + if (GET_CODE (x) == LABEL_REF) + LABEL_PRESERVE_P (XEXP (x, 0)) = 1; + /* Allocate a pool constant descriptor, fill it in, and chain it in. */ pool = (struct pool_constant *) ggc_alloc (sizeof (struct pool_constant)); -- 2.7.4