This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ColdFire 49/63] Save and restore the PIC register when using a constant pool
Reload can legitimately introduce constant pool references into
a function that didn't otherwise have them. We're interested
in three events when this happens:
(a) reload decides to force something into the constant pool
(b) reload and config/m68k together decide the final frame layout
(c) reload emits the input and output reload instructions
These events happen in the order listed.
When generating PIC, the PIC form of the address is introduced
by (c), which in turn sets current_function_uses_pic_offset_table.
However, we need to know in (b) whether to save the PIC register.
AIUI, the canonical way of dealing with this is to check
current_function_uses_const_pool.
Richard
gcc/
* config/m68k/m68k.c (m68k_save_reg): Save the PIC register in
functions that need a constant pool.
Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc/config/m68k/m68k.c 2007-01-09 15:02:22.000000000 +0000
+++ gcc/config/m68k/m68k.c 2007-01-09 15:02:23.000000000 +0000
@@ -746,6 +746,13 @@ m68k_save_reg (unsigned int regno, bool
{
if (current_function_uses_pic_offset_table)
return true;
+ /* Reload may introduce constant pool references into a function
+ that thitherto didn't need a PIC register. Note that the test
+ above will not catch that case because we will only set
+ current_function_uses_pic_offset_table when emitting
+ the address reloads. */
+ if (current_function_uses_const_pool)
+ return true;
}
if (current_function_calls_eh_return)