From 46fad5b72188e6627c63ce1979375deacfd7bdf6 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Fri, 18 May 2001 22:01:54 +0000 Subject: [PATCH] rs6000.c (secondary_reload_class): Fix Darwin specific misuse of r0 as a reload address. 2001-05-18 Dale Johannesen * config/rs6000/rs6000.c (secondary_reload_class): Fix Darwin specific misuse of r0 as a reload address. From-SVN: r42287 --- gcc/ChangeLog | 5 +++++ gcc/config/rs6000/rs6000.c | 27 ++++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e89fddc56f0..6ff92046539 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-05-18 Dale Johannesen + + * config/rs6000/rs6000.c (secondary_reload_class): Fix Darwin + specific misuse of r0 as a reload address. + Fri May 18 22:42:04 CEST 2001 Jan Hubicka * combine.c (combine_simplify_rtx): Clear op0_mode if simplification diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 8d2a799b8e3..9376b2a97ea 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -3587,17 +3587,22 @@ secondary_reload_class (class, mode, in) { int regno; -#if TARGET_ELF - /* We can not copy a symbolic operand directly into anything other than - BASE_REGS for TARGET_ELF. So indicate that a register from BASE_REGS - is needed as an intermediate register. */ - if (class != BASE_REGS - && (GET_CODE (in) == SYMBOL_REF - || GET_CODE (in) == HIGH - || GET_CODE (in) == LABEL_REF - || GET_CODE (in) == CONST)) - return BASE_REGS; -#endif + if (TARGET_ELF || (DEFAULT_ABI == ABI_DARWIN && flag_pic)) + { + /* We cannot copy a symbolic operand directly into anything + other than BASE_REGS for TARGET_ELF. So indicate that a + register from BASE_REGS is needed as an intermediate + register. + + On Darwin, pic addresses require a load from memory, which + needs a base register. */ + if (class != BASE_REGS + && (GET_CODE (in) == SYMBOL_REF + || GET_CODE (in) == HIGH + || GET_CODE (in) == LABEL_REF + || GET_CODE (in) == CONST)) + return BASE_REGS; + } if (GET_CODE (in) == REG) { -- 2.30.2