* [parisc-linux] Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
[not found] <Pine.LNX.4.21.0101151238510.21322-100000@front.linuxcare.com.au>
@ 2001-01-15 11:09 ` Alan Modra
2001-01-15 16:24 ` John David Anglin
2001-01-15 17:46 ` Jeffrey A Law
0 siblings, 2 replies; 20+ messages in thread
From: Alan Modra @ 2001-01-15 11:09 UTC (permalink / raw)
To: John David Anglin; +Cc: Jeffrey A Law, gcc-patches, parisc-linux
This patch rids us of PIC_OFFSET_TABLE_REGNUM_SAVED, and the problems that
go with it. Additionally, I reload the pic offset table register before
calls to guard against asm trashing r27/r19. Hasn't bootstrapped yet, but
looks promising. One possible fly in the ointment is whether any ABI
requires that r4 always be used to save the pic offset table reg.
* config/pa/pa.h (PIC_OFFSET_TABLE_REGNUM_SAVED): Remove.
(machine_function): Define.
(PIC_OFFSET_TABLE_SAVE_RTX) : Define.
(INIT_EXPANDERS): Define.
* config/pa/pa.c (pa_init_machine_status, pa_free_machine_status,
pa_init_expanders): New functions.
(hppa_expand_prologue): Use PIC_OFFSET_TABLE_SAVE_RTX instead of
PIC_OFFSET_TABLE_REGNUM_SAVED.
* config/pa/pa.md: Use PIC_OFFSET_TABLE_SAVE_RTX instead of
PIC_OFFSET_TABLE_REGNUM_SAVED throughout. Restore pic offset
table register before all calls as well as after.
* config/pa/pa32-regs.h (CONDITIONAL_REGISTER_USAGE): Remove
references to PIC_OFFSET_TABLE_REGNUM_SAVED.
* config/pa/pa64-regs.h (CONDITIONAL_REGISTER_USAGE): Likewise.
Alan Modra
--
Linuxcare. Support for the Revolution.
diff -urp -xCVS egcs/gcc/config/pa/pa.c newegcs/gcc/config/pa/pa.c
--- egcs/gcc/config/pa/pa.c Thu Jan 4 15:22:58 2001
+++ newegcs/gcc/config/pa/pa.c Mon Jan 15 20:54:01 2001
@@ -2918,6 +2918,40 @@ output_function_prologue (file, size)
remove_useless_addtr_insns (get_insns (), 0);
}
+/* Functions to initialize pic_offset_table_save_rtx.
+ These will be called, via pointer variables,
+ from push_function_context and pop_function_context. */
+
+static void
+pa_init_machine_status (p)
+ struct function *p;
+{
+ p->machine = (machine_function *) xmalloc (sizeof (machine_function));
+
+ p->machine->pic_offset_table_save_rtx = gen_reg_rtx (Pmode);
+}
+
+static void
+pa_free_machine_status (p)
+ struct function *p;
+{
+ if (p->machine == NULL)
+ return;
+
+ free (p->machine);
+ p->machine = NULL;
+}
+
+/* Do anything needed before RTL is emitted for each function. */
+
+void
+pa_init_expanders ()
+{
+ /* Arrange to save and restore machine status around nested functions. */
+ init_machine_status = pa_init_machine_status;
+ free_machine_status = pa_free_machine_status;
+}
+
void
hppa_expand_prologue()
{
@@ -3155,17 +3189,10 @@ hppa_expand_prologue()
So instead, we copy the PIC register into a reserved callee saved
register in the prologue. Then after each call we reload the PIC
- register from the callee saved register. We also reload the PIC
- register from the callee saved register in the epilogue ensure the
- PIC register is valid at function exit.
-
- This may (depending on the exact characteristics of the function)
- even be more efficient.
-
- Avoid this if the callee saved register wasn't used (these are
- leaf functions). */
- if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM_SAVED])
- emit_move_insn (gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED),
+ register from the callee saved register. */
+
+ if (flag_pic && 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));
}
Only in newegcs/gcc/config/pa: pa.c~
diff -urp -xCVS egcs/gcc/config/pa/pa.h newegcs/gcc/config/pa/pa.h
--- egcs/gcc/config/pa/pa.h Thu Jan 4 15:22:58 2001
+++ newegcs/gcc/config/pa/pa.h Mon Jan 15 20:54:01 2001
@@ -70,6 +70,14 @@ enum architecture_type
ARCHITECTURE_20
};
+struct rtx_def;
+/* A C structure for machine-specific, per-function data.
+ This is added to the cfun structure. */
+typedef struct machine_function
+{
+ struct rtx_def *pic_offset_table_save_rtx;
+} machine_function;
+
/* For -march= option. */
extern const char *pa_arch_string;
extern enum architecture_type pa_arch;
@@ -493,8 +501,8 @@ extern int target_flags;
#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 1
/* Register into which we save the PIC_OFFEST_TABLE_REGNUM so that it
- can be restore across function calls. */
-#define PIC_OFFSET_TABLE_REGNUM_SAVED 4
+ can be restored across function calls. */
+#define PIC_OFFSET_TABLE_SAVE_RTX (cfun->machine->pic_offset_table_save_rtx)
#define DEFAULT_PCC_STRUCT_RETURN 0
@@ -854,6 +862,10 @@ extern enum cmp_type hppa_branch_type;
DELTA, target_name, DELTA); \
fprintf (FILE, "\n\t.EXIT\n\t.PROCEND\n"); \
}
+
+/* Initialize data used by insn expanders. This is called from
+ init_emit, once for each function, before code is generated. */
+#define INIT_EXPANDERS pa_init_expanders ()
/* This macro generates the assembly code for function entry.
FILE is a stdio stream to output the code to.
Only in newegcs/gcc/config/pa: pa.h~
diff -urp -xCVS egcs/gcc/config/pa/pa.md newegcs/gcc/config/pa/pa.md
--- egcs/gcc/config/pa/pa.md Mon Jan 8 22:47:00 2001
+++ newegcs/gcc/config/pa/pa.md Mon Jan 15 20:53:58 2001
@@ -5711,6 +5711,7 @@
emit_move_insn (arg_pointer_rtx,
gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
GEN_INT (64)));
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
/* Use two different patterns for calls to explicitly named functions
and calls through function pointers. This is necessary as these two
@@ -5735,18 +5736,12 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
if (TARGET_64BIT)
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
@@ -5888,6 +5883,8 @@
gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
GEN_INT (64)));
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
+
/* Use two different patterns for calls to explicitly named functions
and calls through function pointers. This is necessary as these two
types of calls use different calling conventions, and CSE might try
@@ -5915,18 +5912,12 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
if (TARGET_64BIT)
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
@@ -6090,22 +6081,18 @@
op = XEXP (operands[0], 0);
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
+
/* We do not allow indirect sibling calls. */
call_insn = emit_call_insn (gen_sibcall_internal_symref (op, operands[1]));
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
@@ -6151,6 +6138,8 @@
op = XEXP (operands[1], 0);
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
+
/* We do not allow indirect sibling calls. */
call_insn = emit_call_insn (gen_sibcall_value_internal_symref (operands[0],
op,
@@ -6158,16 +6147,10 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
Only in newegcs/gcc/config/pa: pa.md~
diff -urp -xCVS egcs/gcc/config/pa/pa32-regs.h newegcs/gcc/config/pa/pa32-regs.h
--- egcs/gcc/config/pa/pa32-regs.h Thu Jan 11 16:10:48 2001
+++ newegcs/gcc/config/pa/pa32-regs.h Mon Jan 15 18:22:39 2001
@@ -110,11 +110,7 @@
fixed_regs[i] = call_used_regs[i] = 1; \
} \
if (flag_pic) \
- { \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- call_used_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- } \
+ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
}
/* Allocate the call used registers first. This should minimize
diff -urp -xCVS egcs/gcc/config/pa/pa64-regs.h newegcs/gcc/config/pa/pa64-regs.h
--- egcs/gcc/config/pa/pa64-regs.h Thu Jan 11 16:10:48 2001
+++ newegcs/gcc/config/pa/pa64-regs.h Mon Jan 15 18:22:40 2001
@@ -109,11 +109,7 @@ Boston, MA 02111-1307, USA. */
fixed_regs[i] = call_used_regs[i] = 1; \
} \
if (flag_pic) \
- { \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- call_used_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- } \
+ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
}
/* Allocate the call used registers first. This should minimize
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-15 11:09 ` [parisc-linux] Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED Alan Modra
@ 2001-01-15 16:24 ` John David Anglin
2001-01-15 16:38 ` Jeffrey A Law
2001-01-15 23:17 ` Alan Modra
2001-01-15 17:46 ` Jeffrey A Law
1 sibling, 2 replies; 20+ messages in thread
From: John David Anglin @ 2001-01-15 16:24 UTC (permalink / raw)
To: Alan Modra; +Cc: law, gcc-patches, parisc-linux
> This patch rids us of PIC_OFFSET_TABLE_REGNUM_SAVED, and the problems that
> go with it. Additionally, I reload the pic offset table register before
> calls to guard against asm trashing r27/r19. Hasn't bootstrapped yet, but
> looks promising. One possible fly in the ointment is whether any ABI
> requires that r4 always be used to save the pic offset table reg.
At first glance, this looks like a good solution. I don't see any requirement
that r4 be used to save the pic offset table reg in either ABI.
However, why is it necessary to guard against asms trashing r27/r19? If
this happens, data access using gp won't work as well. Shouldn't asms
ensure that they restore r27/r19 if they trash it? If in fact r27/r19
needs to be restored prior to calls, it looks like it also needs to be
restored prior to each procedure return (see below). This would prevent
the trivial return from ever being generated whenever pic code is used.
Thus, it seems necessary to ensure that r27/r19 is preserved from entry
to exit.
This is what the 64-Bit ABI says about r27:
GR 27 serves as the global pointer (gp). This is a dedicated register with
special conventions. Its use is subject to the following rules:
a) On entry to a procedure, gp is guaranteed valid for that procedure.
b) At any direct procedure call, gp must be valid (for the caller). This
guarantees that an import stub (see Section 5.2) can access the linkage
table.
c) Any procedure call (indirect or direct) may destroy gp--unless the call
is known to be local to the load module.
d) At procedure return, gp must be valid (for the returning procedure).
This allows us to optimize calls known to be local (the exception to
Rule `c').
The effect of these rules is that gp must be treated as a scratch register
at a point of call but a procedure must preserve it from entry to exit.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-15 16:24 ` John David Anglin
@ 2001-01-15 16:38 ` Jeffrey A Law
2001-01-15 23:17 ` Alan Modra
1 sibling, 0 replies; 20+ messages in thread
From: Jeffrey A Law @ 2001-01-15 16:38 UTC (permalink / raw)
To: John David Anglin; +Cc: Alan Modra, gcc-patches, parisc-linux
In message <200101151624.LAA26183@hiauly1.hia.nrc.ca>you write:
> > This patch rids us of PIC_OFFSET_TABLE_REGNUM_SAVED, and the problems tha
> t
> > go with it. Additionally, I reload the pic offset table register before
> > calls to guard against asm trashing r27/r19. Hasn't bootstrapped yet, bu
> t
> > looks promising. One possible fly in the ointment is whether any ABI
> > requires that r4 always be used to save the pic offset table reg.
>
> At first glance, this looks like a good solution. I don't see any
> requirementthat r4 be used to save the pic offset table reg in either ABI.
It is not an ABI requirement. It was done because GCC was unable
reasonably cope with a PIC register that was call-clobbered.
> However, why is it necessary to guard against asms trashing r27/r19? If
> this happens, data access using gp won't work as well. Shouldn't asms
> ensure that they restore r27/r19 if they trash it? If in fact r27/r19
> needs to be restored prior to calls, it looks like it also needs to be
> restored prior to each procedure return (see below). This would prevent
> the trivial return from ever being generated whenever pic code is used.
> Thus, it seems necessary to ensure that r27/r19 is preserved from entry
> to exit.
If an ASM trashes a fixed register, then the ASM is responsible for restoring
it.
jeff
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-15 11:09 ` [parisc-linux] Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED Alan Modra
2001-01-15 16:24 ` John David Anglin
@ 2001-01-15 17:46 ` Jeffrey A Law
2001-01-15 23:07 ` Alan Modra
1 sibling, 1 reply; 20+ messages in thread
From: Jeffrey A Law @ 2001-01-15 17:46 UTC (permalink / raw)
To: Alan Modra; +Cc: John David Anglin, gcc-patches, parisc-linux
In message <Pine.LNX.4.21.0101151430350.21322-100000@front.linuxcare.com.au>y
ou write:
> This patch rids us of PIC_OFFSET_TABLE_REGNUM_SAVED, and the problems that
> go with it. Additionally, I reload the pic offset table register before
> calls to guard against asm trashing r27/r19. Hasn't bootstrapped yet, but
> looks promising. One possible fly in the ointment is whether any ABI
> requires that r4 always be used to save the pic offset table reg.
>
> * config/pa/pa.h (PIC_OFFSET_TABLE_REGNUM_SAVED): Remove.
> (machine_function): Define.
> (PIC_OFFSET_TABLE_SAVE_RTX) : Define.
> (INIT_EXPANDERS): Define.
> * config/pa/pa.c (pa_init_machine_status, pa_free_machine_status,
> pa_init_expanders): New functions.
> (hppa_expand_prologue): Use PIC_OFFSET_TABLE_SAVE_RTX instead of
> PIC_OFFSET_TABLE_REGNUM_SAVED.
> * config/pa/pa.md: Use PIC_OFFSET_TABLE_SAVE_RTX instead of
> PIC_OFFSET_TABLE_REGNUM_SAVED throughout. Restore pic offset
> table register before all calls as well as after.
> * config/pa/pa32-regs.h (CONDITIONAL_REGISTER_USAGE): Remove
> references to PIC_OFFSET_TABLE_REGNUM_SAVED.
> * config/pa/pa64-regs.h (CONDITIONAL_REGISTER_USAGE): Likewise.
First, if an ASM trashes a fixed register, then it is the ASM's responsibility
to restore it. So that part of this patch is wrong.
The rest of it looks pretty reasonable and can be installed.
jeff
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-15 17:46 ` Jeffrey A Law
@ 2001-01-15 23:07 ` Alan Modra
2001-01-16 1:20 ` Alan Modra
0 siblings, 1 reply; 20+ messages in thread
From: Alan Modra @ 2001-01-15 23:07 UTC (permalink / raw)
To: Jeffrey A Law; +Cc: John David Anglin, gcc-patches, parisc-linux
On Mon, 15 Jan 2001, Jeffrey A Law wrote:
> First, if an ASM trashes a fixed register, then it is the ASM's responsibility
> to restore it. So that part of this patch is wrong.
OK, that's fair enough.
> The rest of it looks pretty reasonable and can be installed.
There is possibly a small problem. The test at the end of
hppa_expand_prologue:
if (flag_pic && HARD_REGISTER_P (PIC_OFFSET_TABLE_SAVE_RTX))
might be wrong. I tested HARD_REGISTER_P because we don't want to emit
the instruction as part of the prologue if PIC_OFFSET_TABLE_SAVE_RTX is
dead. What happens if register pressure causes the pseudo to be allocated
a stack slot?
Alan Modra
--
Linuxcare. Support for the Revolution.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-15 16:24 ` John David Anglin
2001-01-15 16:38 ` Jeffrey A Law
@ 2001-01-15 23:17 ` Alan Modra
1 sibling, 0 replies; 20+ messages in thread
From: Alan Modra @ 2001-01-15 23:17 UTC (permalink / raw)
To: John David Anglin; +Cc: law, gcc-patches, parisc-linux
On Mon, 15 Jan 2001, John David Anglin wrote:
> The effect of these rules is that gp must be treated as a scratch register
> at a point of call but a procedure must preserve it from entry to exit.
Interestingly, gcc currently does not always preserve gp.
extern void foo (void);
int main (void) { foo(); return 0; }
compiled with -O gives
std %r2,-16(%r30)
ldo 128(%r30),%r30
std %r3,-128(%r30)
copy %r27,%r3
b,l __main,%r2
ldo -16(%r30),%r29
copy %r3,%r27
b,l foo,%r2
ldo -16(%r30),%r29
ldi 0,%r28
ldd -144(%r30),%r2
bve (%r2)
ldd,mb -128(%r30),%r3
and gp is not restored after the call to foo.
--
Linuxcare. Support for the Revolution.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-15 23:07 ` Alan Modra
@ 2001-01-16 1:20 ` Alan Modra
2001-01-16 5:53 ` Richard Henderson
0 siblings, 1 reply; 20+ messages in thread
From: Alan Modra @ 2001-01-16 1:20 UTC (permalink / raw)
To: Jeffrey A Law; +Cc: John David Anglin, gcc-patches, parisc-linux
On Tue, 16 Jan 2001, I wrote:
> There is possibly a small problem. The test at the end of
> hppa_expand_prologue:
Here is an updated patch that cures this, and doesn't restore r27 before
calls.
* config/pa/pa.h (PIC_OFFSET_TABLE_REGNUM_SAVED): Remove.
(machine_function): Define.
(PIC_OFFSET_TABLE_SAVE_RTX) : Define.
(INIT_EXPANDERS): Define.
* config/pa/pa.c (pa_init_machine_status, pa_free_machine_status,
pa_init_expanders): New functions.
(hppa_expand_prologue): Use PIC_OFFSET_TABLE_SAVE_RTX instead of
PIC_OFFSET_TABLE_REGNUM_SAVED.
* config/pa/pa.md: Use PIC_OFFSET_TABLE_SAVE_RTX instead of
PIC_OFFSET_TABLE_REGNUM_SAVED throughout.
* config/pa/pa32-regs.h (CONDITIONAL_REGISTER_USAGE): Remove
references to PIC_OFFSET_TABLE_REGNUM_SAVED.
* config/pa/pa64-regs.h (CONDITIONAL_REGISTER_USAGE): Likewise.
Alan Modra
--
Linuxcare. Support for the Revolution.
diff -urp -xCVS egcs/gcc/config/pa/pa.c newegcs/gcc/config/pa/pa.c
--- egcs/gcc/config/pa/pa.c Thu Jan 4 15:22:58 2001
+++ newegcs/gcc/config/pa/pa.c Tue Jan 16 10:45:25 2001
@@ -2918,6 +2918,40 @@ output_function_prologue (file, size)
remove_useless_addtr_insns (get_insns (), 0);
}
+/* Functions to initialize pic_offset_table_save_rtx.
+ These will be called, via pointer variables,
+ from push_function_context and pop_function_context. */
+
+static void
+pa_init_machine_status (p)
+ struct function *p;
+{
+ p->machine = (machine_function *) xmalloc (sizeof (machine_function));
+
+ p->machine->pic_offset_table_save_rtx = gen_reg_rtx (Pmode);
+}
+
+static void
+pa_free_machine_status (p)
+ struct function *p;
+{
+ if (p->machine == NULL)
+ return;
+
+ free (p->machine);
+ p->machine = NULL;
+}
+
+/* Do anything needed before RTL is emitted for each function. */
+
+void
+pa_init_expanders ()
+{
+ /* Arrange to save and restore machine status around nested functions. */
+ init_machine_status = pa_init_machine_status;
+ free_machine_status = pa_free_machine_status;
+}
+
void
hppa_expand_prologue()
{
@@ -3153,19 +3187,17 @@ hppa_expand_prologue()
made incorrect assumptions about using global variables to hold
per-function rtl code generated in the backend.
- So instead, we copy the PIC register into a reserved callee saved
- register in the prologue. Then after each call we reload the PIC
- register from the callee saved register. We also reload the PIC
- register from the callee saved register in the epilogue ensure the
- PIC register is valid at function exit.
-
- This may (depending on the exact characteristics of the function)
- even be more efficient.
-
- Avoid this if the callee saved register wasn't used (these are
- leaf functions). */
- if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM_SAVED])
- emit_move_insn (gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED),
+ So instead, we copy the PIC register into a callee saved register
+ in the prologue. Then after each call we reload the PIC register
+ from the callee saved register.
+
+ Avoid doing this if the register isn't used (eg. leaf functions)
+ as it's an error to delete an instruction from the prologue. */
+
+ 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));
}
diff -urp -xCVS egcs/gcc/config/pa/pa.h newegcs/gcc/config/pa/pa.h
--- egcs/gcc/config/pa/pa.h Thu Jan 4 15:22:58 2001
+++ newegcs/gcc/config/pa/pa.h Mon Jan 15 20:54:01 2001
@@ -70,6 +70,14 @@ enum architecture_type
ARCHITECTURE_20
};
+struct rtx_def;
+/* A C structure for machine-specific, per-function data.
+ This is added to the cfun structure. */
+typedef struct machine_function
+{
+ struct rtx_def *pic_offset_table_save_rtx;
+} machine_function;
+
/* For -march= option. */
extern const char *pa_arch_string;
extern enum architecture_type pa_arch;
@@ -493,8 +501,8 @@ extern int target_flags;
#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 1
/* Register into which we save the PIC_OFFEST_TABLE_REGNUM so that it
- can be restore across function calls. */
-#define PIC_OFFSET_TABLE_REGNUM_SAVED 4
+ can be restored across function calls. */
+#define PIC_OFFSET_TABLE_SAVE_RTX (cfun->machine->pic_offset_table_save_rtx)
#define DEFAULT_PCC_STRUCT_RETURN 0
@@ -854,6 +862,10 @@ extern enum cmp_type hppa_branch_type;
DELTA, target_name, DELTA); \
fprintf (FILE, "\n\t.EXIT\n\t.PROCEND\n"); \
}
+
+/* Initialize data used by insn expanders. This is called from
+ init_emit, once for each function, before code is generated. */
+#define INIT_EXPANDERS pa_init_expanders ()
/* This macro generates the assembly code for function entry.
FILE is a stdio stream to output the code to.
diff -urp -xCVS egcs/gcc/config/pa/pa.md newegcs/gcc/config/pa/pa.md
--- egcs/gcc/config/pa/pa.md Mon Jan 8 22:47:00 2001
+++ newegcs/gcc/config/pa/pa.md Tue Jan 16 10:45:58 2001
@@ -5735,18 +5735,12 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
if (TARGET_64BIT)
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
@@ -5915,18 +5909,12 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
if (TARGET_64BIT)
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
@@ -6096,16 +6084,10 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
@@ -6158,16 +6140,10 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
diff -urp -xCVS egcs/gcc/config/pa/pa32-regs.h newegcs/gcc/config/pa/pa32-regs.h
--- egcs/gcc/config/pa/pa32-regs.h Thu Jan 11 16:10:48 2001
+++ newegcs/gcc/config/pa/pa32-regs.h Mon Jan 15 18:22:39 2001
@@ -110,11 +110,7 @@
fixed_regs[i] = call_used_regs[i] = 1; \
} \
if (flag_pic) \
- { \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- call_used_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- } \
+ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
}
/* Allocate the call used registers first. This should minimize
diff -urp -xCVS egcs/gcc/config/pa/pa64-regs.h newegcs/gcc/config/pa/pa64-regs.h
--- egcs/gcc/config/pa/pa64-regs.h Thu Jan 11 16:10:48 2001
+++ newegcs/gcc/config/pa/pa64-regs.h Mon Jan 15 18:22:40 2001
@@ -109,11 +109,7 @@ Boston, MA 02111-1307, USA. */
fixed_regs[i] = call_used_regs[i] = 1; \
} \
if (flag_pic) \
- { \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- call_used_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- } \
+ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
}
/* Allocate the call used registers first. This should minimize
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-16 1:20 ` Alan Modra
@ 2001-01-16 5:53 ` Richard Henderson
2001-01-16 9:28 ` Alan Modra
0 siblings, 1 reply; 20+ messages in thread
From: Richard Henderson @ 2001-01-16 5:53 UTC (permalink / raw)
To: Alan Modra; +Cc: Jeffrey A Law, John David Anglin, gcc-patches, parisc-linux
On Tue, Jan 16, 2001 at 12:20:19PM +1100, Alan Modra wrote:
> * config/pa/pa.c (pa_init_machine_status, pa_free_machine_status,
> pa_init_expanders): New functions.
You need a mark_machine_status function. It is also much better
to set the global variables once in override_options than for
every function in init_expanders.
r~
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-16 5:53 ` Richard Henderson
@ 2001-01-16 9:28 ` Alan Modra
2001-01-17 3:23 ` John David Anglin
` (2 more replies)
0 siblings, 3 replies; 20+ messages in thread
From: Alan Modra @ 2001-01-16 9:28 UTC (permalink / raw)
To: Richard Henderson
Cc: Jeffrey A Law, John David Anglin, gcc-patches, parisc-linux
On Mon, 15 Jan 2001, Richard Henderson wrote:
> On Tue, Jan 16, 2001 at 12:20:19PM +1100, Alan Modra wrote:
> > * config/pa/pa.c (pa_init_machine_status, pa_free_machine_status,
> > pa_init_expanders): New functions.
>
> You need a mark_machine_status function. It is also much better
> to set the global variables once in override_options than for
> every function in init_expanders.
OK, here we go.
gcc/ChangeLog
* config/pa/pa.h (PIC_OFFSET_TABLE_REGNUM_SAVED): Remove.
(machine_function): Define.
(PIC_OFFSET_TABLE_SAVE_RTX) : Define.
* config/pa/pa.c (pa_init_machine_status, pa_mark_machine_status,
pa_free_machine_status): New functions.
(override_options): Set {init,mark,free}_machine_status to above.
(hppa_expand_prologue): Use PIC_OFFSET_TABLE_SAVE_RTX instead of
PIC_OFFSET_TABLE_REGNUM_SAVED.
* config/pa/pa.md: Use PIC_OFFSET_TABLE_SAVE_RTX instead of
PIC_OFFSET_TABLE_REGNUM_SAVED throughout.
* config/pa/pa32-regs.h (CONDITIONAL_REGISTER_USAGE): Remove
references to PIC_OFFSET_TABLE_REGNUM_SAVED.
* config/pa/pa64-regs.h (CONDITIONAL_REGISTER_USAGE): Likewise.
Alan Modra
--
Linuxcare. Support for the Revolution.
diff -urp -xCVS egcs/gcc/config/pa/pa.c newegcs/gcc/config/pa/pa.c
--- egcs/gcc/config/pa/pa.c Thu Jan 4 15:22:58 2001
+++ newegcs/gcc/config/pa/pa.c Tue Jan 16 18:12:37 2001
@@ -1,5 +1,5 @@
/* Subroutines for insn-output.c for HPPA.
- Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
+ Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
Contributed by Tim Moore (moore@cs.utah.edu), based on sparc.c
@@ -43,6 +43,9 @@ Boston, MA 02111-1307, USA. */
#include "recog.h"
#include "tm_p.h"
+static void pa_init_machine_status PARAMS ((struct function *));
+static void pa_mark_machine_status PARAMS ((struct function *));
+static void pa_free_machine_status PARAMS ((struct function *));
static void pa_combine_instructions PARAMS ((rtx));
static int pa_can_combine_p PARAMS ((rtx, rtx, rtx, int, rtx, rtx, rtx));
static int forward_branch_p PARAMS ((rtx));
@@ -186,6 +189,43 @@ override_options ()
/* Register global variables with the garbage collector. */
pa_add_gc_roots ();
+
+ /* Arrange to save and restore machine status around nested functions. */
+ init_machine_status = pa_init_machine_status;
+ mark_machine_status = pa_mark_machine_status;
+ free_machine_status = pa_free_machine_status;
+}
+
+/* Functions to initialize pic_offset_table_save_rtx.
+ These will be called, via pointer variables,
+ from push_function_context and pop_function_context. */
+
+static void
+pa_init_machine_status (p)
+ struct function *p;
+{
+ p->machine = (machine_function *) xmalloc (sizeof (machine_function));
+
+ p->machine->pic_offset_table_save_rtx = gen_reg_rtx (Pmode);
+}
+
+static void
+pa_mark_machine_status (p)
+ struct function *p;
+{
+ if (p->machine)
+ ggc_mark_rtx (p->machine->pic_offset_table_save_rtx);
+}
+
+static void
+pa_free_machine_status (p)
+ struct function *p;
+{
+ if (p->machine == NULL)
+ return;
+
+ free (p->machine);
+ p->machine = NULL;
}
@@ -2653,7 +2693,7 @@ remove_useless_addtr_insns (insns, check
}
\f
-/* You may have trouble believing this, but this is the HP-PA stack
+/* You may have trouble believing this, but this is the 32 bit HP-PA stack
layout. Wow.
Offset Contents
@@ -3153,19 +3193,17 @@ hppa_expand_prologue()
made incorrect assumptions about using global variables to hold
per-function rtl code generated in the backend.
- So instead, we copy the PIC register into a reserved callee saved
- register in the prologue. Then after each call we reload the PIC
- register from the callee saved register. We also reload the PIC
- register from the callee saved register in the epilogue ensure the
- PIC register is valid at function exit.
-
- This may (depending on the exact characteristics of the function)
- even be more efficient.
-
- Avoid this if the callee saved register wasn't used (these are
- leaf functions). */
- if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM_SAVED])
- emit_move_insn (gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED),
+ So instead, we copy the PIC register into a callee saved register
+ in the prologue. Then after each call we reload the PIC register
+ from the callee saved register.
+
+ Avoid doing this if the register isn't used (eg. leaf functions)
+ as it's an error to delete an instruction from the prologue. */
+
+ 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));
}
diff -urp -xCVS egcs/gcc/config/pa/pa.h newegcs/gcc/config/pa/pa.h
--- egcs/gcc/config/pa/pa.h Thu Jan 4 15:22:58 2001
+++ newegcs/gcc/config/pa/pa.h Tue Jan 16 18:02:14 2001
@@ -70,6 +70,14 @@ enum architecture_type
ARCHITECTURE_20
};
+struct rtx_def;
+/* A C structure for machine-specific, per-function data.
+ This is added to the cfun structure. */
+typedef struct machine_function
+{
+ struct rtx_def *pic_offset_table_save_rtx;
+} machine_function;
+
/* For -march= option. */
extern const char *pa_arch_string;
extern enum architecture_type pa_arch;
@@ -493,8 +501,8 @@ extern int target_flags;
#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 1
/* Register into which we save the PIC_OFFEST_TABLE_REGNUM so that it
- can be restore across function calls. */
-#define PIC_OFFSET_TABLE_REGNUM_SAVED 4
+ can be restored across function calls. */
+#define PIC_OFFSET_TABLE_SAVE_RTX (cfun->machine->pic_offset_table_save_rtx)
#define DEFAULT_PCC_STRUCT_RETURN 0
diff -urp -xCVS egcs/gcc/config/pa/pa.md newegcs/gcc/config/pa/pa.md
--- egcs/gcc/config/pa/pa.md Mon Jan 8 22:47:00 2001
+++ newegcs/gcc/config/pa/pa.md Tue Jan 16 10:45:58 2001
@@ -5735,18 +5735,12 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
if (TARGET_64BIT)
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
@@ -5915,18 +5909,12 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
if (TARGET_64BIT)
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), arg_pointer_rtx);
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
@@ -6096,16 +6084,10 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
@@ -6158,16 +6140,10 @@
if (flag_pic)
{
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
- use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn),
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
/* After each call we must restore the PIC register, even if it
- doesn't appear to be used.
-
- This will set regs_ever_live for the callee saved register we
- stored the PIC register in. */
- emit_move_insn (pic_offset_table_rtx,
- gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM_SAVED));
+ doesn't appear to be used. */
+ emit_move_insn (pic_offset_table_rtx, PIC_OFFSET_TABLE_SAVE_RTX);
}
DONE;
}")
diff -urp -xCVS egcs/gcc/config/pa/pa32-regs.h newegcs/gcc/config/pa/pa32-regs.h
--- egcs/gcc/config/pa/pa32-regs.h Thu Jan 11 16:10:48 2001
+++ newegcs/gcc/config/pa/pa32-regs.h Mon Jan 15 18:22:39 2001
@@ -110,11 +110,7 @@
fixed_regs[i] = call_used_regs[i] = 1; \
} \
if (flag_pic) \
- { \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- call_used_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- } \
+ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
}
/* Allocate the call used registers first. This should minimize
diff -urp -xCVS egcs/gcc/config/pa/pa64-regs.h newegcs/gcc/config/pa/pa64-regs.h
--- egcs/gcc/config/pa/pa64-regs.h Thu Jan 11 16:10:48 2001
+++ newegcs/gcc/config/pa/pa64-regs.h Mon Jan 15 18:22:40 2001
@@ -109,11 +109,7 @@ Boston, MA 02111-1307, USA. */
fixed_regs[i] = call_used_regs[i] = 1; \
} \
if (flag_pic) \
- { \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- call_used_regs[PIC_OFFSET_TABLE_REGNUM_SAVED] = 1;\
- } \
+ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
}
/* Allocate the call used registers first. This should minimize
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-16 9:28 ` Alan Modra
@ 2001-01-17 3:23 ` John David Anglin
2001-01-17 3:54 ` John David Anglin
2001-01-17 5:26 ` Jeffrey A Law
2001-01-17 5:30 ` Jeffrey A Law
2 siblings, 1 reply; 20+ messages in thread
From: John David Anglin @ 2001-01-17 3:23 UTC (permalink / raw)
To: Alan Modra; +Cc: rth, law, gcc-patches, parisc-linux
> OK, here we go.
I am currently bootstrapping with the patch. However, we still have the
prologue ICE warning which Kenner wants to turn into an abort:
./xgcc -B./ -B/usr/local/hppa1.1-hp-hpux10.20/bin/ -isystem /usr/local/hppa1.1-hp-hpux10.20/include -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -isystem ./include -fPIC -g1 -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/config -I../../gcc/../include -DUSE_COLLECT2 -DL_floatditf -c ../../gcc/libgcc2.c -o libgcc/./_floatditf.o
../../gcc/libgcc2.c: In function `__floatditf':
../../gcc/libgcc2.c:1043: warning: ICE: would have deleted prologue/epilogue ins
n
(insn 372 370 373 (set (reg:SI 4 %r4 [94])
(reg:SI 19 %r19)) -1 (nil)
(nil))
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-17 3:23 ` John David Anglin
@ 2001-01-17 3:54 ` John David Anglin
0 siblings, 0 replies; 20+ messages in thread
From: John David Anglin @ 2001-01-17 3:54 UTC (permalink / raw)
To: John David Anglin; +Cc: alan, rth, law, gcc-patches, parisc-linux
> ../../gcc/libgcc2.c:1043: warning: ICE: would have deleted prologue/epilogue ins
> n
> (insn 372 370 373 (set (reg:SI 4 %r4 [94])
> (reg:SI 19 %r19)) -1 (nil)
> (nil))
The patch has problems:
__floatditf
.PROC
.CALLINFO FRAME=192,CALLS,SAVE_RP,ENTRY_GR=4
.ENTRY
...
stw %r4,-72(%r30)
...
copy %r19,%r4
...
bl _U_Qfadd,%r2
stw %r19,-32(%r30)
copy %r3,%r28
...
ldw -212(%r30),%r2
ldw -72(%r30),%r4
ldw -68(%r30),%r3
bv %r0(%r2)
ldo -192(%r30),%r30
.EXIT
.PROCEND
The restoration of r19 after the call to _U_Qfadd is deleted in the flow2
pass. When this happens, the prologue save to r4 isn't needed leading to
the ICE warning. However, the restoration of r19 after the call shouldn't
be deleted because r19 is needed for the return (previous discussion).
We need a "use" in the return to prevent this.
The save of r19 to the stack looks extraneous but I think it is mandated
by the ABI.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-16 9:28 ` Alan Modra
2001-01-17 3:23 ` John David Anglin
@ 2001-01-17 5:26 ` Jeffrey A Law
2001-01-17 5:30 ` Jeffrey A Law
2 siblings, 0 replies; 20+ messages in thread
From: Jeffrey A Law @ 2001-01-17 5:26 UTC (permalink / raw)
To: Alan Modra
Cc: Richard Henderson, John David Anglin, gcc-patches, parisc-linux
In message <Pine.LNX.4.21.0101161848180.4272-100000@front.linuxcare.com.au>yo
u write:
> On Mon, 15 Jan 2001, Richard Henderson wrote:
>
> > On Tue, Jan 16, 2001 at 12:20:19PM +1100, Alan Modra wrote:
> > > * config/pa/pa.c (pa_init_machine_status, pa_free_machine_statu
> s,
> > > pa_init_expanders): New functions.
> >
> > You need a mark_machine_status function. It is also much better
> > to set the global variables once in override_options than for
> > every function in init_expanders.
Actually, just to be clear, we don't want to do this initialization
in the override_options since we're generating a register! We need to
do that for each function!
> gcc/ChangeLog
> * config/pa/pa.h (PIC_OFFSET_TABLE_REGNUM_SAVED): Remove.
> (machine_function): Define.
> (PIC_OFFSET_TABLE_SAVE_RTX) : Define.
> * config/pa/pa.c (pa_init_machine_status, pa_mark_machine_status,
> pa_free_machine_status): New functions.
> (override_options): Set {init,mark,free}_machine_status to above.
> (hppa_expand_prologue): Use PIC_OFFSET_TABLE_SAVE_RTX instead of
> PIC_OFFSET_TABLE_REGNUM_SAVED.
> * config/pa/pa.md: Use PIC_OFFSET_TABLE_SAVE_RTX instead of
> PIC_OFFSET_TABLE_REGNUM_SAVED throughout.
> * config/pa/pa32-regs.h (CONDITIONAL_REGISTER_USAGE): Remove
> references to PIC_OFFSET_TABLE_REGNUM_SAVED.
> * config/pa/pa64-regs.h (CONDITIONAL_REGISTER_USAGE): Likewise.
I've installed this patch.
Jeff
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-16 9:28 ` Alan Modra
2001-01-17 3:23 ` John David Anglin
2001-01-17 5:26 ` Jeffrey A Law
@ 2001-01-17 5:30 ` Jeffrey A Law
2001-01-17 5:59 ` John David Anglin
2001-01-17 7:24 ` Alan Modra
2 siblings, 2 replies; 20+ messages in thread
From: Jeffrey A Law @ 2001-01-17 5:30 UTC (permalink / raw)
To: Alan Modra
Cc: Richard Henderson, John David Anglin, gcc-patches, parisc-linux
In message <Pine.LNX.4.21.0101161848180.4272-100000@front.linuxcare.com.au>yo
u write:
> + 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));
I do have a question about this particular hunk of code.
I can't think of a condition where PIC_OFFSET_TABLE_SAVE_RTX would not be
a reg when this code was executed. Simlarly I can't think of a case where
it would be a hard reg.
I think we should just emit the insn unconditionally unless you're aware
of some reason we can't shouldn't.
We're probably also going to need to emit a use of the %r19 and maybe %r27
on the return insns to ensure the pic register is restored after the
final call in any given function.
jeff
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-17 5:30 ` Jeffrey A Law
@ 2001-01-17 5:59 ` John David Anglin
2001-01-17 7:24 ` Alan Modra
1 sibling, 0 replies; 20+ messages in thread
From: John David Anglin @ 2001-01-17 5:59 UTC (permalink / raw)
To: law; +Cc: alan, rth, gcc-patches, parisc-linux
>
> In message <Pine.LNX.4.21.0101161848180.4272-100000@front.linuxcare.com.au>yo
> u write:
> > + 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));
> I do have a question about this particular hunk of code.
>
> I can't think of a condition where PIC_OFFSET_TABLE_SAVE_RTX would not be
> a reg when this code was executed. Simlarly I can't think of a case where
> it would be a hard reg.
>
> I think we should just emit the insn unconditionally unless you're aware
> of some reason we can't shouldn't.
I am fairly certain that it is being emitted (see email from a couple
hours ago about ICE warning). As I understand it, the reason we don't
emit it unconditionally is that insns can't be deleted in the prologue,
so we try not to emit it if it isn't needed.
> We're probably also going to need to emit a use of the %r19 and maybe %r27
> on the return insns to ensure the pic register is restored after the
> final call in any given function.
Yup.
I am currently running a bootstrap with the following additional patch.
I reverted to EPILOGUE_USES because I have the feeling that there are
problems with putting the use in the return insn. See the last test
results which I posted yesterday at
<http://gcc.gnu.org/ml/gcc-testresults/2001-01/msg00204.html>.
The results were done with a stock built except for reverting the call
used patch for the PIC_OFFSET_TABLE_REGNUM_SAVED register. A previous
run using EPILOGUE_USES rather than the use in the trivial return had
much better results. However, it is possible the problem is elsewhere.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2001-01-17 John David Anglin <dave@hiauly1.hia.nrc.ca>
* pa.h (EPILOGUE_USES): Define. The epilogue uses the return pointer
and when generating pic code the pic offset table register.
* pa.md (return, return_internal): Rework.
--- pa.h.save Tue Jan 16 18:08:18 2001
+++ pa.h Tue Jan 16 23:44:08 2001
@@ -500,7 +500,7 @@
#define PIC_OFFSET_TABLE_REGNUM (TARGET_64BIT ? 27 : 19)
#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 1
-/* Register into which we save the PIC_OFFEST_TABLE_REGNUM so that it
+/* Register into which we save the PIC_OFFSET_TABLE_REGNUM so that it
can be restored across function calls. */
#define PIC_OFFSET_TABLE_SAVE_RTX (cfun->machine->pic_offset_table_save_rtx)
@@ -918,6 +918,9 @@
#define FUNCTION_EPILOGUE(FILE, SIZE) \
output_function_epilogue (FILE, SIZE)
+#define EPILOGUE_USES(REGNO) \
+ ((REGNO) == 2 || (flag_pic && (REGNO) == PIC_OFFSET_TABLE_REGNUM))
+
/* Output assembler code for a block containing the constant parts
of a trampoline, leaving space for the variable parts.\
--- pa.md.save Tue Jan 16 18:08:21 2001
+++ pa.md Tue Jan 16 18:11:02 2001
@@ -5467,9 +5467,7 @@
;; Unconditional and other jump instructions.
(define_insn "return"
- [(return)
- (use (reg:SI 2))
- (const_int 0)]
+ [(return)]
"hppa_can_use_return_insn_p ()"
"*
{
@@ -5485,7 +5483,7 @@
(define_insn "return_internal"
[(return)
(use (reg:SI 2))
- (const_int 1)]
+ (const_int 0)]
""
"*
{
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-17 5:30 ` Jeffrey A Law
2001-01-17 5:59 ` John David Anglin
@ 2001-01-17 7:24 ` Alan Modra
2001-01-17 16:09 ` Jeffrey A Law
1 sibling, 1 reply; 20+ messages in thread
From: Alan Modra @ 2001-01-17 7:24 UTC (permalink / raw)
To: Jeffrey A Law
Cc: Richard Henderson, John David Anglin, gcc-patches, parisc-linux
On Tue, 16 Jan 2001, Jeffrey A Law wrote:
> In message <Pine.LNX.4.21.0101161848180.4272-100000@front.linuxcare.com.au>yo
> u write:
> > + 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));
> I do have a question about this particular hunk of code.
>
> I can't think of a condition where PIC_OFFSET_TABLE_SAVE_RTX would not be
> a reg when this code was executed. Simlarly I can't think of a case where
> it would be a hard reg.
What I was trying to do here is test whether the pseudo has been allocated
a register, or the case where register pressure causes it to spill to a
stack slot. I must admit coding something based on inspecting rtl here
under gdb, ie. without a real understanding of what I was doing :-(
There seemed to be three cases:
- register isn't used so appears as a pseudo
- register is allocated a hard reg
- register is allocated a stack slot
> I think we should just emit the insn unconditionally unless you're aware
> of some reason we can't shouldn't.
That causes an error when no dlt save register is needed - prologue
instruction would be deleted.
> We're probably also going to need to emit a use of the %r19 and maybe %r27
> on the return insns to ensure the pic register is restored after the
> final call in any given function.
I've a "use" in the epilogue in my tree. Hadn't posted that patch as I
wasn't sure it's correct in the face of tail calls.
Alan Modra
--
Linuxcare. Support for the Revolution.
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-17 7:24 ` Alan Modra
@ 2001-01-17 16:09 ` Jeffrey A Law
2001-01-17 16:22 ` John David Anglin
0 siblings, 1 reply; 20+ messages in thread
From: Jeffrey A Law @ 2001-01-17 16:09 UTC (permalink / raw)
To: Alan Modra
Cc: Richard Henderson, John David Anglin, gcc-patches, parisc-linux
In message <Pine.LNX.4.21.0101171802240.9957-100000@front.linuxcare.com.au>yo
u write:
> What I was trying to do here is test whether the pseudo has been allocated
> a register, or the case where register pressure causes it to spill to a
> stack slot.
But the code in question is executed during insn expansion time -- long long
before we know anything about whether or not a particular pseudo register
will be allocated to a hard register or stack slot.
> There seemed to be three cases:
> - register isn't used so appears as a pseudo
> - register is allocated a hard reg
> - register is allocated a stack slot
But I can't see how the final two cases could happen at that stage in
compilation. If you actually saw these under the debugger, I'd like you to
investigate them further since I don't believe they can/should happen.
[ Note that I'm not convinced the old check to avoid the restore was
correct either. ]
> > I think we should just emit the insn unconditionally unless you're aware
> > of some reason we can't shouldn't.
>
> That causes an error when no dlt save register is needed - prologue
> instruction would be deleted.
If we emit a call, then we must reload the PIC register. There's no iffs
ands or butts about it. If that's causing aborts/warnings, then we've likely
got a bug _elsewhere_. It's entirely possible that getting the use on the
return insn will fix that problem.
> > We're probably also going to need to emit a use of the %r19 and maybe %r2
> 7
> > on the return insns to ensure the pic register is restored after the
> > final call in any given function.
>
> I've a "use" in the epilogue in my tree. Hadn't posted that patch as I
> wasn't sure it's correct in the face of tail calls.
We can't perform tail calls when we're generating PIC code right now
(right now PIC == code suitable for shared library on the PA). Consider
linkage issues.
What makes this interesting is that we don't need/want the use on the trivial
return, but we do want it on the return_internal pattern. Furthermore, the
register we want to use varies depending on PA32 vs PA64 ABIs.
I've got a patch which handles that stuff in my local tree that I'm testing
right now.
jeff
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-17 16:09 ` Jeffrey A Law
@ 2001-01-17 16:22 ` John David Anglin
2001-01-17 21:42 ` Jeffrey A Law
0 siblings, 1 reply; 20+ messages in thread
From: John David Anglin @ 2001-01-17 16:22 UTC (permalink / raw)
To: law; +Cc: alan, rth, gcc-patches, parisc-linux
> In message <Pine.LNX.4.21.0101171802240.9957-100000@front.linuxcare.com.au>yo
> u write:
> > What I was trying to do here is test whether the pseudo has been allocated
> > a register, or the case where register pressure causes it to spill to a
> > stack slot.
> But the code in question is executed during insn expansion time -- long long
> before we know anything about whether or not a particular pseudo register
> will be allocated to a hard register or stack slot.
>
> > There seemed to be three cases:
> > - register isn't used so appears as a pseudo
> > - register is allocated a hard reg
> > - register is allocated a stack slot
> But I can't see how the final two cases could happen at that stage in
> compilation. If you actually saw these under the debugger, I'd like you to
> investigate them further since I don't believe they can/should happen.
I think all these problems can be resolved by emitting the insn at the
first call. We just have to keep track of whether it has been emitted
or not.
Then, the optimiser can eliminate it if it decides it is better
to reload the pic offset table register from the stack. We don't have
to worry about where it is allocated, adding notes, etc.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-17 16:22 ` John David Anglin
@ 2001-01-17 21:42 ` Jeffrey A Law
2001-01-17 22:20 ` John David Anglin
2001-01-18 6:04 ` John David Anglin
0 siblings, 2 replies; 20+ messages in thread
From: Jeffrey A Law @ 2001-01-17 21:42 UTC (permalink / raw)
To: John David Anglin; +Cc: alan, rth, gcc-patches, parisc-linux
In message <200101171622.LAA13215@hiauly1.hia.nrc.ca>you write:
> I think all these problems can be resolved by emitting the insn at the
> first call. We just have to keep track of whether it has been emitted
> or not.
I'm not entirely sure what you mean by this.
We must emit the code to restore the PIC register after each call when
generating PIC code. There are no known exceptions to this rule.
You might be talking about saving the PIC register into the stack or
pseudo during the prologue. Yes, we could arrange to do that if and
only if we had a call in PIC mode. That's fairly easy to do.
jeff
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-17 21:42 ` Jeffrey A Law
@ 2001-01-17 22:20 ` John David Anglin
2001-01-18 6:04 ` John David Anglin
1 sibling, 0 replies; 20+ messages in thread
From: John David Anglin @ 2001-01-17 22:20 UTC (permalink / raw)
To: law; +Cc: alan, rth, gcc-patches, parisc-linux
> In message <200101171622.LAA13215@hiauly1.hia.nrc.ca>you write:
> > I think all these problems can be resolved by emitting the insn at the
> > first call. We just have to keep track of whether it has been emitted
> > or not.
> I'm not entirely sure what you mean by this.
>
> We must emit the code to restore the PIC register after each call when
> generating PIC code. There are no known exceptions to this rule.
>
> You might be talking about saving the PIC register into the stack or
> pseudo during the prologue. Yes, we could arrange to do that if and
> only if we had a call in PIC mode. That's fairly easy to do.
Yes, I am talking about saving the pic register just before the first call
insn rather than in the prologue. This way we know that the save is needed
and we don't have to worry about whether the pseudo that is initially
generated for it gets a hard register or not. If there are no calls, the
insn won't be emitted. The insn can also be eliminated if reload decides
to use the stack saved value of the PIC register for restoration of the PIC
register after calls. The 32 bit ABI saves it to the stack under almost
all circumstances.
We just need to add a flag to Alan's machine structure, initialize it
when the structure is created, and test it before each call insn. If it
is 0, we save the PIC register and set the flag.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED
2001-01-17 21:42 ` Jeffrey A Law
2001-01-17 22:20 ` John David Anglin
@ 2001-01-18 6:04 ` John David Anglin
1 sibling, 0 replies; 20+ messages in thread
From: John David Anglin @ 2001-01-18 6:04 UTC (permalink / raw)
To: law; +Cc: alan, rth, gcc-patches, parisc-linux
> In message <200101171622.LAA13215@hiauly1.hia.nrc.ca>you write:
> > I think all these problems can be resolved by emitting the insn at the
> > first call. We just have to keep track of whether it has been emitted
> > or not.
> I'm not entirely sure what you mean by this.
>
> We must emit the code to restore the PIC register after each call when
> generating PIC code. There are no known exceptions to this rule.
>
> You might be talking about saving the PIC register into the stack or
> pseudo during the prologue. Yes, we could arrange to do that if and
> only if we had a call in PIC mode. That's fairly easy to do.
I think this will make what I was saying clearer. This doesn't suffer
from the problem that the original implementation had because it doesn't
use a global variable. Bootstrap is now in the latter part of stage 2.
I looked at the assembly code generated for a function with one call
and it seemed fine.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2001-01-17 John David Anglin <dave@hiauly1.hia.nrc.ca>
* pa.c (pa_init_machine_status): Initialize
p->machine->pic_offset_table_reg_saved.
(hppa_expand_prologue): Remove code to save pic offset table register.
* pa.h (machine_function): Add member pic_offset_table_reg_saved.
(PIC_OFFSET_TABLE_SAVE_RTX): Correct typo in comment.
(PIC_OFFSET_TABLE_REG_SAVED): Define.
(EPILOGUE_USES): Define to keep the pic offset table register live.
* pa.md (call, call_value): Add code to save the pic offset table
register when necessary.
--- pa.c.orig Wed Jan 17 01:46:52 2001
+++ pa.c Wed Jan 17 19:09:38 2001
@@ -207,6 +207,7 @@
p->machine = (machine_function *) xmalloc (sizeof (machine_function));
p->machine->pic_offset_table_save_rtx = gen_reg_rtx (Pmode);
+ p->machine->pic_offset_table_reg_saved = 0;
}
static void
@@ -3186,25 +3187,6 @@
}
}
}
-
- /* When generating PIC code it is necessary to save/restore the
- PIC register around each function call. We used to do this
- in the call patterns themselves, but that implementation
- made incorrect assumptions about using global variables to hold
- per-function rtl code generated in the backend.
-
- So instead, we copy the PIC register into a callee saved register
- in the prologue. Then after each call we reload the PIC register
- from the callee saved register.
-
- Avoid doing this if the register isn't used (eg. leaf functions)
- as it's an error to delete an instruction from the prologue. */
-
- 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));
}
--- pa.h.orig Wed Jan 17 18:52:09 2001
+++ pa.h Wed Jan 17 19:05:02 2001
@@ -76,6 +76,7 @@
typedef struct machine_function
{
struct rtx_def *pic_offset_table_save_rtx;
+ int pic_offset_table_reg_saved;
} machine_function;
/* For -march= option. */
@@ -500,10 +501,14 @@
#define PIC_OFFSET_TABLE_REGNUM (TARGET_64BIT ? 27 : 19)
#define PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 1
-/* Register into which we save the PIC_OFFEST_TABLE_REGNUM so that it
+/* Register into which we save the PIC_OFFSET_TABLE_REGNUM so that it
can be restored across function calls. */
#define PIC_OFFSET_TABLE_SAVE_RTX (cfun->machine->pic_offset_table_save_rtx)
+/* Flag to indicate whether the pic offset table register has been saved
+ in a function. */
+#define PIC_OFFSET_TABLE_REG_SAVED (cfun->machine->pic_offset_table_reg_saved)
+
#define DEFAULT_PCC_STRUCT_RETURN 0
/* SOM ABI says that objects larger than 64 bits are returned in memory.
@@ -918,6 +923,12 @@
#define FUNCTION_EPILOGUE(FILE, SIZE) \
output_function_epilogue (FILE, SIZE)
+/* Define this macro as a C expression that is nonzero for registers
+ used by the epilogue or the `return' pattern. */
+
+#define EPILOGUE_USES(REGNO) \
+ ((REGNO) == 2 || (flag_pic && (REGNO) == PIC_OFFSET_TABLE_REGNUM))
+
/* Output assembler code for a block containing the constant parts
of a trampoline, leaving space for the variable parts.\
--- pa.md.orig Wed Jan 17 01:46:53 2001
+++ pa.md Wed Jan 17 19:31:57 2001
@@ -5712,6 +5712,13 @@
gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
GEN_INT (64)));
+ if (flag_pic && ! PIC_OFFSET_TABLE_REG_SAVED)
+ {
+ emit_move_insn (PIC_OFFSET_TABLE_SAVE_RTX,
+ gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM));
+ PIC_OFFSET_TABLE_REG_SAVED = 1;
+ }
+
/* Use two different patterns for calls to explicitly named functions
and calls through function pointers. This is necessary as these two
types of calls use different calling conventions, and CSE might try
@@ -5882,6 +5889,13 @@
gen_rtx_PLUS (word_mode, virtual_outgoing_args_rtx,
GEN_INT (64)));
+ if (flag_pic && ! PIC_OFFSET_TABLE_REG_SAVED)
+ {
+ emit_move_insn (PIC_OFFSET_TABLE_SAVE_RTX,
+ gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM));
+ PIC_OFFSET_TABLE_REG_SAVED = 1;
+ }
+
/* Use two different patterns for calls to explicitly named functions
and calls through function pointers. This is necessary as these two
types of calls use different calling conventions, and CSE might try
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2001-01-18 6:00 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <Pine.LNX.4.21.0101151238510.21322-100000@front.linuxcare.com.au>
2001-01-15 11:09 ` [parisc-linux] Oust HPPA PIC_OFFSET_TABLE_REGNUM_SAVED Alan Modra
2001-01-15 16:24 ` John David Anglin
2001-01-15 16:38 ` Jeffrey A Law
2001-01-15 23:17 ` Alan Modra
2001-01-15 17:46 ` Jeffrey A Law
2001-01-15 23:07 ` Alan Modra
2001-01-16 1:20 ` Alan Modra
2001-01-16 5:53 ` Richard Henderson
2001-01-16 9:28 ` Alan Modra
2001-01-17 3:23 ` John David Anglin
2001-01-17 3:54 ` John David Anglin
2001-01-17 5:26 ` Jeffrey A Law
2001-01-17 5:30 ` Jeffrey A Law
2001-01-17 5:59 ` John David Anglin
2001-01-17 7:24 ` Alan Modra
2001-01-17 16:09 ` Jeffrey A Law
2001-01-17 16:22 ` John David Anglin
2001-01-17 21:42 ` Jeffrey A Law
2001-01-17 22:20 ` John David Anglin
2001-01-18 6:04 ` John David Anglin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox