Commit da6f15cd by Jeff Law

pa.md (call, call_value): Always save the PIC register before a call.

	* pa.md (call, call_value): Always save the PIC register before
	a call.

From-SVN: r8836
parent 8e6c802b
...@@ -3426,13 +3426,19 @@ ...@@ -3426,13 +3426,19 @@
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx); use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
if (!hppa_save_pic_table_rtx) if (!hppa_save_pic_table_rtx)
{ hppa_save_pic_table_rtx = gen_reg_rtx (Pmode);
hppa_save_pic_table_rtx = gen_reg_rtx (Pmode);
emit_insn_before (gen_rtx (SET, VOIDmode, /* We must save and restore the PIC register around every call
hppa_save_pic_table_rtx, since we don't have flow information to determine if this save
pic_offset_table_rtx), is redundant with a previous save. The old code assumed once
call_insn); the register was saved it never needs to be saved again, but
} the save could have been on a path which doesn't always
execute; a call site physically later in the program would
then attempt a restore from an uninitialized register! */
emit_insn_before (gen_rtx (SET, VOIDmode,
hppa_save_pic_table_rtx,
pic_offset_table_rtx),
call_insn);
emit_insn (gen_rtx (SET, VOIDmode, pic_offset_table_rtx, emit_insn (gen_rtx (SET, VOIDmode, pic_offset_table_rtx,
hppa_save_pic_table_rtx)); hppa_save_pic_table_rtx));
...@@ -3522,13 +3528,19 @@ ...@@ -3522,13 +3528,19 @@
use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx); use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx);
if (!hppa_save_pic_table_rtx) if (!hppa_save_pic_table_rtx)
{ hppa_save_pic_table_rtx = gen_reg_rtx (Pmode);
hppa_save_pic_table_rtx = gen_reg_rtx (Pmode);
emit_insn_before (gen_rtx (SET, VOIDmode, /* We must save and restore the PIC register around every call
hppa_save_pic_table_rtx, since we don't have flow information to determine if this save
pic_offset_table_rtx), is redundant with a previous save. The old code assumed once
call_insn); the register was saved it never needs to be saved again, but
} the save could have been on a path which doesn't always
execute; a call site physically later in the program would
then attempt a restore from an uninitialized register! */
emit_insn_before (gen_rtx (SET, VOIDmode,
hppa_save_pic_table_rtx,
pic_offset_table_rtx),
call_insn);
emit_insn (gen_rtx (SET, VOIDmode, pic_offset_table_rtx, emit_insn (gen_rtx (SET, VOIDmode, pic_offset_table_rtx,
hppa_save_pic_table_rtx)); hppa_save_pic_table_rtx));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment