diff options
author | Jeff Law <law@gcc.gnu.org> | 1995-02-08 00:53:09 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1995-02-08 00:53:09 -0700 |
commit | 2387b8d7af5623e7016b250ddb23a1f9e73299de (patch) | |
tree | 0aeaa0f32b0fba87681ee440da974f3943474f27 | |
parent | e553bfb99a96003ab5e2ef7fff56087518302436 (diff) | |
download | gcc-2387b8d7af5623e7016b250ddb23a1f9e73299de.zip gcc-2387b8d7af5623e7016b250ddb23a1f9e73299de.tar.gz gcc-2387b8d7af5623e7016b250ddb23a1f9e73299de.tar.bz2 |
pa.md (call, call_value): Emit save of the PIC register with "emit_insn" before emitting the call insn itself.
* pa.md (call, call_value): Emit save of the PIC register
with "emit_insn" before emitting the call insn itself.
From-SVN: r8892
-rw-r--r-- | gcc/config/pa/pa.md | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index dd9a6d2..b7ae3ad 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -3480,6 +3480,24 @@ else op = XEXP (operands[0], 0); + if (flag_pic) + { + if (!hppa_save_pic_table_rtx) + hppa_save_pic_table_rtx = gen_reg_rtx (Pmode); + + /* We must save and restore the PIC register around every call + since we don't have flow information to determine if this save + is redundant with a previous save. The old code assumed once + 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 (gen_rtx (SET, VOIDmode, + hppa_save_pic_table_rtx, + pic_offset_table_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 @@ -3495,21 +3513,6 @@ { use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx); - if (!hppa_save_pic_table_rtx) - hppa_save_pic_table_rtx = gen_reg_rtx (Pmode); - - /* We must save and restore the PIC register around every call - since we don't have flow information to determine if this save - is redundant with a previous save. The old code assumed once - 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, hppa_save_pic_table_rtx)); } @@ -3579,6 +3582,24 @@ else op = XEXP (operands[1], 0); + if (flag_pic) + { + if (!hppa_save_pic_table_rtx) + hppa_save_pic_table_rtx = gen_reg_rtx (Pmode); + + /* We must save and restore the PIC register around every call + since we don't have flow information to determine if this save + is redundant with a previous save. The old code assumed once + 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 (gen_rtx (SET, VOIDmode, + hppa_save_pic_table_rtx, + pic_offset_table_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 @@ -3597,21 +3618,6 @@ { use_reg (&CALL_INSN_FUNCTION_USAGE (call_insn), pic_offset_table_rtx); - if (!hppa_save_pic_table_rtx) - hppa_save_pic_table_rtx = gen_reg_rtx (Pmode); - - /* We must save and restore the PIC register around every call - since we don't have flow information to determine if this save - is redundant with a previous save. The old code assumed once - 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, hppa_save_pic_table_rtx)); } |