aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1994-03-22 16:02:25 -0800
committerJim Wilson <wilson@gcc.gnu.org>1994-03-22 16:02:25 -0800
commit508a48d1f460d14cbe808ec9932a747fcedfce5d (patch)
tree0e255f691fa235cd5b1c7f2e1d94cbb5c7a2cd3d
parentbc0989e960ab0068c50945279225f839421b626b (diff)
downloadgcc-508a48d1f460d14cbe808ec9932a747fcedfce5d.zip
gcc-508a48d1f460d14cbe808ec9932a747fcedfce5d.tar.gz
gcc-508a48d1f460d14cbe808ec9932a747fcedfce5d.tar.bz2
(pic_address_needs_scratch): New function.
(override_options): Set flag_pic when TARGET_ABICALLS. From-SVN: r6848
-rw-r--r--gcc/config/mips/mips.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 9e0f3e1..83c31f1 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -1655,6 +1655,22 @@ mips_address_cost (addr)
return 4;
}
+/* Return true if X is an address which needs a temporary register when
+ reloaded while generating PIC code. */
+
+int
+pic_address_needs_scratch (x)
+ rtx x;
+{
+ /* An address which is a symbolic plus a non SMALL_INT needs a temp reg. */
+ if (GET_CODE (x) == CONST && GET_CODE (XEXP (x, 0)) == PLUS
+ && GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
+ && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
+ && ! SMALL_INT (XEXP (XEXP (x, 0), 1)))
+ return 1;
+
+ return 0;
+}
/* Make normal rtx_code into something we can index from an array */
@@ -3245,8 +3261,18 @@ override_options ()
if (TARGET_HALF_PIC)
HALF_PIC_INIT ();
+ /* -fpic (-KPIC) is the default when TARGET_ABICALLS is defined. We need
+ to set flag_pic so that the LEGITIMATE_PIC_OPERAND_P macro will work. */
+ /* ??? -non_shared turns off pic code generation, but this is not
+ implemented. */
if (TARGET_ABICALLS)
- mips_abicalls = MIPS_ABICALLS_YES;
+ {
+ mips_abicalls = MIPS_ABICALLS_YES;
+ flag_pic = 1;
+ /* ??? Is this sufficient? */
+ if (mips_section_threshold > 0)
+ warning ("-G is incompatible with PIC code which is the default");
+ }
else
mips_abicalls = MIPS_ABICALLS_NO;