diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-01 04:51:24 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-02-01 04:51:24 +0000 |
commit | cf3de5bbee618e61b5f02320af9d771092ee8dda (patch) | |
tree | ba0d0ad99eb2470d3829081115b1ba68dfc013a0 | |
parent | cccfb31e6c4026c30bebce6ee3cd18aaf6ea7715 (diff) | |
download | gcc-cf3de5bbee618e61b5f02320af9d771092ee8dda.tar.gz |
* (hppa_init_pic_save): Emit the pic offset table
reg save after last_parm_insn.
* pa.c (hppa_init_pic_save): New function.
* pa.h (hppa_init_pic_save): Declare.
* pa.md (call, call_value, sibcall, sibcall_value): Use
the above instead of duplicated code.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39386 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/pa/pa.c | 15 | ||||
-rw-r--r-- | gcc/config/pa/pa.h | 1 | ||||
-rw-r--r-- | gcc/config/pa/pa.md | 52 |
4 files changed, 27 insertions, 48 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f9c693afdc7..0ec6c1a37f0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2001-01-31 Alan Modra <alan@linuxcare.com.au> + * (hppa_init_pic_save): Emit the pic offset table + reg save after last_parm_insn. + * pa.c (hppa_init_pic_save): New function. + * pa.h (hppa_init_pic_save): Declare. + * pa.md (call, call_value, sibcall, sibcall_value): Use + the above instead of duplicated code. + * pa.c (hppa_encode_label): Correct size of alloca buffer so we don't overrun it. Correct leading `*' case. * pa.h (STRIP_NAME_ENCODING): Simplify now that we don't diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index 738afbeb344..a7a0b9ec002 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -3371,6 +3371,21 @@ hppa_expand_epilogue () - actual_fsize); } +/* Set up a callee saved register for the pic offset table register. */ +void hppa_init_pic_save () +{ + rtx insn, picreg; + + picreg = gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM); + PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode); + insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX, picreg); + + /* Emit the insn at the beginning of the function after the prologue. */ + push_topmost_sequence (); + emit_insn_after (insn, last_parm_insn ? last_parm_insn : get_insns ()); + pop_topmost_sequence (); +} + /* Fetch the return address for the frame COUNT steps up from the current frame, after the prologue. FRAMEADDR is the frame pointer of the COUNT frame. diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h index a5c7a32d955..e20cffd729f 100644 --- a/gcc/config/pa/pa.h +++ b/gcc/config/pa/pa.h @@ -503,6 +503,7 @@ extern int target_flags; /* 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) +extern void hppa_init_pic_save PARAMS ((void)); #define DEFAULT_PCC_STRUCT_RETURN 0 diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md index 41dc77c0703..ac70bfdc75a 100644 --- a/gcc/config/pa/pa.md +++ b/gcc/config/pa/pa.md @@ -5738,18 +5738,7 @@ GEN_INT (64))); if (flag_pic && PIC_OFFSET_TABLE_SAVE_RTX == NULL_RTX) - { - rtx insn; - - PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode); - insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX, - gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM)); - - /* Emit the insn at the beginning of the function after the prologue. */ - push_topmost_sequence (); - emit_insn_after (insn, get_insns ()); - pop_topmost_sequence (); - } + hppa_init_pic_save (); /* Use two different patterns for calls to explicitly named functions and calls through function pointers. This is necessary as these two @@ -5922,18 +5911,7 @@ GEN_INT (64))); if (flag_pic && PIC_OFFSET_TABLE_SAVE_RTX == NULL_RTX) - { - rtx insn; - - PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode); - insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX, - gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM)); - - /* Emit the insn at the beginning of the function after the prologue. */ - push_topmost_sequence (); - emit_insn_after (insn, get_insns ()); - pop_topmost_sequence (); - } + hppa_init_pic_save (); /* Use two different patterns for calls to explicitly named functions and calls through function pointers. This is necessary as these two @@ -6132,18 +6110,7 @@ op = XEXP (operands[0], 0); if (flag_pic && PIC_OFFSET_TABLE_SAVE_RTX == NULL_RTX) - { - rtx insn; - - PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode); - insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX, - gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM)); - - /* Emit the insn at the beginning of the function after the prologue. */ - push_topmost_sequence (); - emit_insn_after (insn, get_insns ()); - pop_topmost_sequence (); - } + hppa_init_pic_save (); /* We do not allow indirect sibling calls. */ call_insn = emit_call_insn (gen_sibcall_internal_symref (op, operands[1])); @@ -6201,18 +6168,7 @@ op = XEXP (operands[1], 0); if (flag_pic && PIC_OFFSET_TABLE_SAVE_RTX == NULL_RTX) - { - rtx insn; - - PIC_OFFSET_TABLE_SAVE_RTX = gen_reg_rtx (Pmode); - insn = gen_rtx_SET (VOIDmode, PIC_OFFSET_TABLE_SAVE_RTX, - gen_rtx_REG (word_mode, PIC_OFFSET_TABLE_REGNUM)); - - /* Emit the insn at the beginning of the function after the prologue. */ - push_topmost_sequence (); - emit_insn_after (insn, get_insns ()); - pop_topmost_sequence (); - } + hppa_init_pic_save (); /* We do not allow indirect sibling calls. */ call_insn = emit_call_insn (gen_sibcall_value_internal_symref (operands[0], |