summaryrefslogtreecommitdiff
path: root/gcc/jump.c
diff options
context:
space:
mode:
authormatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-08 20:18:08 +0000
committermatz <matz@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-08 20:18:08 +0000
commit409e049a922dec5d9769790764bdaffd8b618ce4 (patch)
tree913be8fcb10baa2e6e9e098eeb7d7b28a3bc79b9 /gcc/jump.c
parent9a4818f1445b5efcd959580be695bbbbdedeca03 (diff)
downloadgcc-409e049a922dec5d9769790764bdaffd8b618ce4.tar.gz
PR middle-end/48389
* jump.c (rebuild_jump_labels_1, rebuild_jump_labels_chain): New functions. (rebuild_jump_labels): Call rebuild_jump_labels_1. * rtl.h (rebuild_jump_labels_chain): Declare. * cfgexpand.c (gimple_expand_cfg): Initialize JUMP_LABEL also on insns inserted on edges. testsuite/ * gcc.target/i386/pr48389.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172208 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/jump.c')
-rw-r--r--gcc/jump.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/gcc/jump.c b/gcc/jump.c
index 8adfbfd5c40..39fc2340c31 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -72,12 +72,9 @@ static void redirect_exp_1 (rtx *, rtx, rtx, rtx);
static int invert_exp_1 (rtx, rtx);
static int returnjump_p_1 (rtx *, void *);
-/* This function rebuilds the JUMP_LABEL field and REG_LABEL_TARGET
- notes in jumping insns and REG_LABEL_OPERAND notes in non-jumping
- instructions and jumping insns that have labels as operands
- (e.g. cbranchsi4). */
-void
-rebuild_jump_labels (rtx f)
+/* Worker for rebuild_jump_labels and rebuild_jump_labels_chain. */
+static void
+rebuild_jump_labels_1 (rtx f, bool count_forced)
{
rtx insn;
@@ -89,11 +86,31 @@ rebuild_jump_labels (rtx f)
closely enough to delete them here, so make sure their reference
count doesn't drop to zero. */
- for (insn = forced_labels; insn; insn = XEXP (insn, 1))
- if (LABEL_P (XEXP (insn, 0)))
- LABEL_NUSES (XEXP (insn, 0))++;
+ if (count_forced)
+ for (insn = forced_labels; insn; insn = XEXP (insn, 1))
+ if (LABEL_P (XEXP (insn, 0)))
+ LABEL_NUSES (XEXP (insn, 0))++;
timevar_pop (TV_REBUILD_JUMP);
}
+
+/* This function rebuilds the JUMP_LABEL field and REG_LABEL_TARGET
+ notes in jumping insns and REG_LABEL_OPERAND notes in non-jumping
+ instructions and jumping insns that have labels as operands
+ (e.g. cbranchsi4). */
+void
+rebuild_jump_labels (rtx f)
+{
+ rebuild_jump_labels_1 (f, true);
+}
+
+/* This function is like rebuild_jump_labels, but doesn't run over
+ forced_labels. It can be used on insn chains that aren't the
+ main function chain. */
+void
+rebuild_jump_labels_chain (rtx chain)
+{
+ rebuild_jump_labels_1 (chain, false);
+}
/* Some old code expects exactly one BARRIER as the NEXT_INSN of a
non-fallthru insn. This is not generally true, as multiple barriers