summaryrefslogtreecommitdiff
path: root/gcc/rtl.c
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1992-12-27 11:53:32 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>1992-12-27 11:53:32 +0000
commit42e57659fa53621bf5d750990de8914e0f13423b (patch)
treea5ac6a49933111a488ff27398fa497f89e7bcd6b /gcc/rtl.c
parentf63d12e321d7eab7a8970b04ed8af89cf6f7ea1c (diff)
downloadgcc-42e57659fa53621bf5d750990de8914e0f13423b.tar.gz
(copy_rtx): A CONST can be shared if it contains a SYMBOL_REF.
A SCRATCH must be shared. A MEM may be shared if it is at a constant address. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@2924 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r--gcc/rtl.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/rtl.c b/gcc/rtl.c
index 9bb704c4fce..8017df1b2c8 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -264,7 +264,23 @@ copy_rtx (orig)
case CODE_LABEL:
case PC:
case CC0:
+ case SCRATCH:
+ /* SCRATCH must be shared because they represent distinct values. */
return orig;
+
+ case CONST:
+ /* CONST can be shared if it contains a SYMBOL_REF. If it contains
+ a LABEL_REF, it isn't sharable. */
+ if (GET_CODE (XEXP (orig, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (orig, 0), 0)) == SYMBOL_REF
+ && GET_CODE (XEXP (XEXP (orig, 0), 1)) == CONST_INT)
+ return orig;
+ break;
+
+ case MEM:
+ if (CONSTANT_ADDRESS_P (XEXP (orig, 0)))
+ return orig;
+ break;
}
copy = rtx_alloc (code);