summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-30 12:41:45 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-30 12:41:45 +0000
commitc080d8f03b137c42b863555fe98a53cbf79b0c98 (patch)
treebf284af1d2de346c28438607b4461f75a47c178a /gcc
parent1a5a5cd8e1186b23c202356655578e6f328aa361 (diff)
downloadgcc-c080d8f03b137c42b863555fe98a53cbf79b0c98.tar.gz
* emit-rtl.c (set_unique_reg_note): Don't create REG_EQUAL or
REG_EQUIV notes for ASM_OPERANDS. Return the new note (if any). * rtl.h (set_unique_reg_note): Change return value. * gcse.c (try_replace_reg): Use set_unique_reg_note. * cse.c (cse_insn): Likewise. * expr.c (emit_move_insn): Likewise. * explow.c (force_reg): Likewise. * local-alloc (update_equiv_regs): Likewise. * loop.c (move_moveables, load_mems): Likewise. * reload (find_reloads): Likewise. * gcc.dg/20011029-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46636 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/cse.c8
-rw-r--r--gcc/emit-rtl.c15
-rw-r--r--gcc/explow.c9
-rw-r--r--gcc/expr.c3
-rw-r--r--gcc/gcse.c3
-rw-r--r--gcc/local-alloc.c10
-rw-r--r--gcc/loop.c16
-rw-r--r--gcc/reload.c6
-rw-r--r--gcc/rtl.h2
-rw-r--r--gcc/testsuite/ChangeLog4
11 files changed, 46 insertions, 43 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dabf4f7ecc4..94976b36047 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+2001-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * emit-rtl.c (set_unique_reg_note): Don't create REG_EQUAL or
+ REG_EQUIV notes for ASM_OPERANDS. Return the new note (if any).
+ * rtl.h (set_unique_reg_note): Change return value.
+ * gcse.c (try_replace_reg): Use set_unique_reg_note.
+ * cse.c (cse_insn): Likewise.
+ * expr.c (emit_move_insn): Likewise.
+ * explow.c (force_reg): Likewise.
+ * local-alloc (update_equiv_regs): Likewise.
+ * loop.c (move_moveables, load_mems): Likewise.
+ * reload (find_reloads): Likewise.
+
2001-10-30 Paolo Bonzini <bonzini@gnu.org>
Localization fixes.
diff --git a/gcc/cse.c b/gcc/cse.c
index cbeae55f72f..ad6c62030fe 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -5648,18 +5648,12 @@ cse_insn (insn, libcall_insn)
&& GET_CODE (XEXP (XEXP (src_const, 0), 0)) == LABEL_REF
&& GET_CODE (XEXP (XEXP (src_const, 0), 1)) == LABEL_REF))
{
- tem = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
/* Make sure that the rtx is not shared with any other insn. */
src_const = copy_rtx (src_const);
/* Record the actual constant value in a REG_EQUAL note, making
a new one if one does not already exist. */
- if (tem)
- XEXP (tem, 0) = src_const;
- else
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL,
- src_const, REG_NOTES (insn));
+ set_unique_reg_note (insn, REG_EQUAL, src_const);
/* If storing a constant value in a register that
previously held the constant value 0,
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 008ceaadcba..992d6049781 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -3960,7 +3960,7 @@ force_next_line_note ()
/* Place a note of KIND on insn INSN with DATUM as the datum. If a
note of this type already exists, remove it first. */
-void
+rtx
set_unique_reg_note (insn, kind, datum)
rtx insn;
enum reg_note kind;
@@ -3968,11 +3968,20 @@ set_unique_reg_note (insn, kind, datum)
{
rtx note = find_reg_note (insn, kind, NULL_RTX);
- /* First remove the note if there already is one. */
+ /* Don't add ASM_OPERAND REG_EQUAL/REG_EQUIV notes.
+ It serves no useful purpose and breaks eliminate_regs. */
+ if ((kind == REG_EQUAL || kind == REG_EQUIV)
+ && GET_CODE (datum) == ASM_OPERANDS)
+ return NULL_RTX;
+
if (note)
- remove_note (insn, note);
+ {
+ XEXP (note, 0) = datum;
+ return note;
+ }
REG_NOTES (insn) = gen_rtx_EXPR_LIST (kind, datum, REG_NOTES (insn));
+ return REG_NOTES (insn);
}
/* Return an indication of which type of insn should have X as a body.
diff --git a/gcc/explow.c b/gcc/explow.c
index d0735aab78a..940a8395191 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -743,14 +743,7 @@ force_reg (mode, x)
if (CONSTANT_P (x)
&& (set = single_set (insn)) != 0
&& SET_DEST (set) == temp)
- {
- rtx note = find_reg_note (insn, REG_EQUAL, NULL_RTX);
-
- if (note)
- XEXP (note, 0) = x;
- else
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_EQUAL, x, REG_NOTES (insn));
- }
+ set_unique_reg_note (insn, REG_EQUAL, x);
return temp;
}
diff --git a/gcc/expr.c b/gcc/expr.c
index b5c5989991f..bf7ec926d7e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -2774,8 +2774,7 @@ emit_move_insn (x, y)
last_insn = emit_move_insn_1 (x, y);
if (y_cst && GET_CODE (x) == REG)
- REG_NOTES (last_insn)
- = gen_rtx_EXPR_LIST (REG_EQUAL, y_cst, REG_NOTES (last_insn));
+ set_unique_reg_note (last_insn, REG_EQUAL, y_cst);
return last_insn;
}
diff --git a/gcc/gcse.c b/gcc/gcse.c
index a91cfd6836e..0bd96e02e4e 100644
--- a/gcc/gcse.c
+++ b/gcc/gcse.c
@@ -3929,8 +3929,7 @@ try_replace_reg (from, to, insn)
/* If we've failed to do replacement, have a single SET, and don't already
have a note, add a REG_EQUAL note to not lose information. */
if (!success && note == 0 && set != 0)
- note = REG_NOTES (insn)
- = gen_rtx_EXPR_LIST (REG_EQUAL, src, REG_NOTES (insn));
+ note = set_unique_reg_note (insn, REG_EQUAL, src);
/* If there is already a NOTE, update the expression in it with our
replacement. */
diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c
index 9945b45d14b..7cee3f5e456 100644
--- a/gcc/local-alloc.c
+++ b/gcc/local-alloc.c
@@ -927,13 +927,9 @@ update_equiv_regs ()
/* cse sometimes generates function invariants, but doesn't put a
REG_EQUAL note on the insn. Since this note would be redundant,
- there's no point creating it earlier than here. Don't do this
- for ASM_OPERANDS since eliminate_regs doesn't support it and
- it serves no useful purpose. */
- if (! note && ! rtx_varies_p (src, 0)
- && GET_CODE (src) != ASM_OPERANDS)
- REG_NOTES (insn)
- = note = gen_rtx_EXPR_LIST (REG_EQUAL, src, REG_NOTES (insn));
+ there's no point creating it earlier than here. */
+ if (! note && ! rtx_varies_p (src, 0))
+ note = set_unique_reg_note (insn, REG_EQUAL, src);
/* Don't bother considering a REG_EQUAL note containing an EXPR_LIST
since it represents a function call */
diff --git a/gcc/loop.c b/gcc/loop.c
index baaa74b59ab..8b2f8daf013 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -1831,9 +1831,9 @@ move_movables (loop, movables, threshold, insn_count)
i1 = loop_insn_hoist (loop, seq);
if (! find_reg_note (i1, REG_EQUAL, NULL_RTX))
- REG_NOTES (i1)
- = gen_rtx_EXPR_LIST (m->is_equiv ? REG_EQUIV : REG_EQUAL,
- m->set_src, REG_NOTES (i1));
+ set_unique_reg_note (i1,
+ m->is_equiv ? REG_EQUIV : REG_EQUAL,
+ m->set_src);
if (loop_dump_stream)
fprintf (loop_dump_stream, " moved to %d", INSN_UID (i1));
@@ -1991,10 +1991,8 @@ move_movables (loop, movables, threshold, insn_count)
i1 = loop_insn_hoist (loop, seq);
if (! find_reg_note (i1, REG_EQUAL, NULL_RTX))
- REG_NOTES (i1)
- = gen_rtx_EXPR_LIST ((m->is_equiv ? REG_EQUIV
- : REG_EQUAL),
- m->set_src, REG_NOTES (i1));
+ set_unique_reg_note (i1, m->is_equiv ? REG_EQUIV
+ : REG_EQUAL, m->set_src);
}
else
i1 = loop_insn_hoist (loop, PATTERN (p));
@@ -9136,9 +9134,7 @@ load_mems (loop)
}
if (const_equiv)
- REG_NOTES (set) = gen_rtx_EXPR_LIST (REG_EQUAL,
- copy_rtx (const_equiv->loc),
- REG_NOTES (set));
+ set_unique_reg_note (set, REG_EQUAL, copy_rtx (const_equiv->loc));
if (written)
{
diff --git a/gcc/reload.c b/gcc/reload.c
index 2e8c93fbe98..9ed9cd09948 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -2666,9 +2666,9 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
&& GET_CODE (reg) == REG
&& (GET_MODE_SIZE (GET_MODE (reg))
>= GET_MODE_SIZE (GET_MODE (op))))
- REG_NOTES (emit_insn_before (gen_rtx_USE (VOIDmode, reg), insn))
- = gen_rtx_EXPR_LIST (REG_EQUAL,
- reg_equiv_memory_loc[REGNO (reg)], NULL_RTX);
+ set_unique_reg_note (emit_insn_before (gen_rtx_USE (VOIDmode, reg),
+ insn),
+ REG_EQUAL, reg_equiv_memory_loc[REGNO (reg)]);
substed_operand[i] = recog_data.operand[i] = op;
}
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 1985f98ea4b..db1e913be44 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1409,7 +1409,7 @@ extern enum machine_mode choose_hard_reg_mode PARAMS ((unsigned int,
unsigned int));
/* In emit-rtl.c */
-extern void set_unique_reg_note PARAMS ((rtx, enum reg_note, rtx));
+extern rtx set_unique_reg_note PARAMS ((rtx, enum reg_note, rtx));
/* Functions in rtlanal.c */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2556eb47f28..d8f07d99732 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2001-10-30 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/20011029-2.c: New test.
+
Mon Oct 29 21:19:53 2001 Nicola Pero <n.pero@mi.flashnet.it>
* objc/execute/class_self-1.m: New test.