aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Earnshaw <rearnsha@arm.com>2001-12-13 13:58:47 +0000
committerRichard Earnshaw <rearnsha@gcc.gnu.org>2001-12-13 13:58:47 +0000
commita3c48721b537b647e904e1db039b15ffc3861cac (patch)
treef0f2c25b447afea3828f98bed47ff95c74b9390e
parent62ab1cafcf809ee77f6183758b27f7b579bd9900 (diff)
downloadgcc-a3c48721b537b647e904e1db039b15ffc3861cac.zip
gcc-a3c48721b537b647e904e1db039b15ffc3861cac.tar.gz
gcc-a3c48721b537b647e904e1db039b15ffc3861cac.tar.bz2
arm.c (legitimize_pic_address): Handle LABEL_REFs in substantially the same way as we handle SYMBOL_REFS.
* arm.c (legitimize_pic_address): Handle LABEL_REFs in substantially the same way as we handle SYMBOL_REFS. From-SVN: r47973
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/arm/arm.c36
2 files changed, 17 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 67931eb..3861aad 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2001-12-13 Richard Earnshaw <rearnsha@arm.com>
+
+ * arm.c (legitimize_pic_address): Handle LABEL_REFs in substantially
+ the same way as we handle SYMBOL_REFS.
+
Thu Dec 13 07:47:24 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* loop.c (remove_constant_addition): Fix prototype and whitespace.
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 98b9230..7ede666 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -2254,7 +2254,8 @@ legitimize_pic_address (orig, mode, reg)
enum machine_mode mode;
rtx reg;
{
- if (GET_CODE (orig) == SYMBOL_REF)
+ if (GET_CODE (orig) == SYMBOL_REF
+ || GET_CODE (orig) == LABEL_REF)
{
#ifndef AOF_ASSEMBLER
rtx pic_ref, address;
@@ -2287,10 +2288,16 @@ legitimize_pic_address (orig, mode, reg)
else
emit_insn (gen_pic_load_addr_thumb (address, orig));
- pic_ref = gen_rtx_MEM (Pmode,
- gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
- address));
- RTX_UNCHANGING_P (pic_ref) = 1;
+ if (GET_CODE (orig) == LABEL_REF && NEED_GOT_RELOC)
+ pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, address);
+ else
+ {
+ pic_ref = gen_rtx_MEM (Pmode,
+ gen_rtx_PLUS (Pmode, pic_offset_table_rtx,
+ address));
+ RTX_UNCHANGING_P (pic_ref) = 1;
+ }
+
insn = emit_move_insn (reg, pic_ref);
#endif
current_function_uses_pic_offset_table = 1;
@@ -2351,25 +2358,6 @@ legitimize_pic_address (orig, mode, reg)
return gen_rtx_PLUS (Pmode, base, offset);
}
- else if (GET_CODE (orig) == LABEL_REF)
- {
- current_function_uses_pic_offset_table = 1;
-
- if (NEED_GOT_RELOC)
- {
- rtx pic_ref, address = gen_reg_rtx (Pmode);
-
- if (TARGET_ARM)
- emit_insn (gen_pic_load_addr_arm (address, orig));
- else
- emit_insn (gen_pic_load_addr_thumb (address, orig));
-
- pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, address);
-
- emit_move_insn (address, pic_ref);
- return address;
- }
- }
return orig;
}