This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PIC_OFFSET_TABLE_SAVE_RTX in large stack frame
- To: Jeffrey A Law <law at redhat dot com>
- Subject: PIC_OFFSET_TABLE_SAVE_RTX in large stack frame
- From: Alan Modra <alan at linuxcare dot com dot au>
- Date: Thu, 25 Jan 2001 22:43:21 +1100 (EST)
- cc: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>, gcc-patches at gcc dot gnu dot org
Here's a fix for a complication I found when compiling glibc. I suspect
Dave's patch to move this code into pa.md requires something similar.
* config/pa/pa.c (hppa_expand_prologue): Handle saves of pic
register into the stack when offset from base is greater than 8k.
Alan Modra
--
Linuxcare. Support for the Revolution.
--- egcs/gcc/config/pa/pa.c Mon Jan 22 00:28:20 2001
+++ newegcs/gcc/config/pa/pa.c Thu Jan 25 21:51:50 2001
@@ -3203,8 +3220,33 @@
if (flag_pic
&& (GET_CODE (PIC_OFFSET_TABLE_SAVE_RTX) != REG
|| HARD_REGISTER_P (PIC_OFFSET_TABLE_SAVE_RTX)))
- emit_move_insn (PIC_OFFSET_TABLE_SAVE_RTX,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM));
+ {
+ rtx dest = PIC_OFFSET_TABLE_SAVE_RTX;
+
+ if (GET_CODE (dest) == MEM)
+ {
+ rtx plus = XEXP (dest, 0);
+ if (GET_CODE (plus) == PLUS)
+ {
+ rtx offset = XEXP (plus, 1);
+ if (GET_CODE (offset) == CONST_INT
+ && !VAL_14_BITS_P (INTVAL (offset)))
+ {
+ /* The save into the stack is too far away from the
+ frame/stack pointer to address it directly. */
+ rtx base, high, low;
+
+ base = XEXP (plus, 0);
+ high = gen_rtx_PLUS (Pmode, base,
+ gen_rtx_HIGH (Pmode, offset));
+ emit_move_insn (tmpreg, high);
+ low = gen_rtx_LO_SUM (Pmode, tmpreg, offset);
+ dest = gen_rtx_MEM (word_mode, low);
+ }
+ }
+ }
+ emit_move_insn (dest, gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM));
+ }
}