[Bug target/51784] PIC register not correctly preserved in nested funcs / with non-local goto

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jan 15 12:55:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51784

--- Comment #34 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-15 12:05:20 UTC ---
(In reply to comment #33)

1) the define_expand isn't needed, just name the define_insn_and_split pattern
as "nonlocal_goto_receiver".

2) it should split always, either to nothing if nothing is needed, or to the
set_got_* plus adjust, so use "#" as the pattern

3) length attribute doesn't make sense for always split insn

4) the split condition should be && epilogue_completed

5) to determine if you need to load the pic register or not, you should match
what
the prologue expansion does, try
(pic_offset_table_rtx
      && (df_regs_ever_live_p (REAL_PIC_OFFSET_TABLE_REGNUM)
          || crtl->profile))
probably also anded with && !current_function_is_leaf - non-local goto receiver
in leaf functions doesn't make much sense and certainly doesn't need to restore
PIC pointer, plus it will simplify it (for leaf functions we sometimes decide
to use a different register as pic pointer instead of %ebx).



More information about the Gcc-bugs mailing list