aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/arm
diff options
context:
space:
mode:
authorRichard Henderson <rth@gcc.gnu.org>2002-03-12 21:42:40 -0800
committerRichard Henderson <rth@gcc.gnu.org>2002-03-12 21:42:40 -0800
commit5b43fed17bf58c31f3151dd37966e7a9b85a309e (patch)
treeff7ebe9916a64b81e187d279cffac13101372cd6 /gcc/config/arm
parent56d4fe31c5265b7f5a0aaea8d5013a7154b211e8 (diff)
downloadgcc-5b43fed17bf58c31f3151dd37966e7a9b85a309e.zip
gcc-5b43fed17bf58c31f3151dd37966e7a9b85a309e.tar.gz
gcc-5b43fed17bf58c31f3151dd37966e7a9b85a309e.tar.bz2
re PR rtl-optimization/5878 (gcc 3.1 breaks on C code generated by the Mercury compiler)
PR 5878 * config/arc/arc.h, config/cris/cris.h, config/i386/i386.h, config/m68k/m68k.h, config/s390/s390.h, config/sparc/sparc.h (PIC_OFFSET_TABLE_REGNUM): Conditionalize on flag_pic. * config/arm/arm.h config/i386/i386.h, config/m68k/m68k.h, config/sparc/sparc.h (CONDITIONAL_REGISTER_USAGE): Set PIC_OFFSET_TABLE_REGNUM based on INVALID_REGNUM not flag_pic. * config/arc/arc.h (CONDITIONAL_REGISTER_USAGE): New. * config/arm/arm.c (arm_pic_register): Init to INVALID_REGNUM. (arm_override_options): Set arm_pic_register if TARGET_APCS_STACK also. Don't set it if not flag_pic. * config/i386/i386.c (ix86_save_reg): Trust PIC_OFFSET_TABLE_REGNUM to be INVALID_REGNUM when not used. * gcc.dg/20020312-2.c: New. From-SVN: r50713
Diffstat (limited to 'gcc/config/arm')
-rw-r--r--gcc/config/arm/arm.c20
-rw-r--r--gcc/config/arm/arm.h2
2 files changed, 10 insertions, 12 deletions
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 4a0e851..8e85957 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -268,7 +268,7 @@ enum machine_mode output_memory_reference_mode;
/* The register number to be used for the PIC offset register. */
const char * arm_pic_register_string = NULL;
-int arm_pic_register = 9;
+int arm_pic_register = INVALID_REGNUM;
/* Set to 1 when a return insn is output, this means that the epilogue
is not needed. */
@@ -651,8 +651,8 @@ arm_override_options ()
/* If stack checking is disabled, we can use r10 as the PIC register,
which keeps r9 available. */
- if (flag_pic && !TARGET_APCS_STACK)
- arm_pic_register = 10;
+ if (flag_pic)
+ arm_pic_register = TARGET_APCS_STACK ? 9 : 10;
if (TARGET_APCS_FLOAT)
warning ("passing floating point arguments in fp regs not yet supported");
@@ -713,18 +713,16 @@ arm_override_options ()
if (arm_pic_register_string != NULL)
{
- int pic_register;
-
+ int pic_register = decode_reg_name (arm_pic_register_string);
+
if (!flag_pic)
warning ("-mpic-register= is useless without -fpic");
- pic_register = decode_reg_name (arm_pic_register_string);
-
/* Prevent the user from choosing an obviously stupid PIC register. */
- if (pic_register < 0 || call_used_regs[pic_register]
- || pic_register == HARD_FRAME_POINTER_REGNUM
- || pic_register == STACK_POINTER_REGNUM
- || pic_register >= PC_REGNUM)
+ else if (pic_register < 0 || call_used_regs[pic_register]
+ || pic_register == HARD_FRAME_POINTER_REGNUM
+ || pic_register == STACK_POINTER_REGNUM
+ || pic_register >= PC_REGNUM)
error ("unable to use '%s' for PIC register", arm_pic_register_string);
else
arm_pic_register = pic_register;
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index c180e26..240595e 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -838,7 +838,7 @@ extern const char * structure_size_string;
regno <= LAST_ARM_FP_REGNUM; ++regno) \
fixed_regs[regno] = call_used_regs[regno] = 1; \
} \
- if (flag_pic) \
+ if (PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \
{ \
fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \