aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sh
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2000-11-25 04:42:27 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2000-11-25 04:42:27 +0000
commit6915629f8173b6687171454aaf8e496416c0ac14 (patch)
tree8cdf9687f6be59ac3e43bc96907242c380ac840c /gcc/config/sh
parent2d01e4457601734bdd414a89d74d87f79cc49d7a (diff)
downloadgcc-6915629f8173b6687171454aaf8e496416c0ac14.zip
gcc-6915629f8173b6687171454aaf8e496416c0ac14.tar.gz
gcc-6915629f8173b6687171454aaf8e496416c0ac14.tar.bz2
sh.md (GOTaddr2picreg, [...]): Don't set current_function_uses_pic_offset_table.
* config/sh/sh.md (GOTaddr2picreg, symGOT2reg, symGOTOFF2reg, symPLT_label2reg, call, call_value): Don't set current_function_uses_pic_offset_table. * config/sh/sh.h (CONDITIONAL_REGISTER_USAGE): Don't mark PIC_OFFSET_TABLE_REGNUM as call_used, so that calc_live_regs takes it into account. (FINALIZE_PIC): Delete, useless. (LEGITIMATE_CONSTANT_P): Delete, unused. * config/sh/sh.c (sh_expand_prologue): Don't use current_function_uses_pic_offset_table. Don't special-case PIC_OFFSET_TABLE_REGNUM. Initialize it if it's ever live and PIC is enabled. (sh_expand_epilogue, initial_elimination_offset): Don't special case PIC_OFFSET_TABLE_REGNUM. From-SVN: r37731
Diffstat (limited to 'gcc/config/sh')
-rw-r--r--gcc/config/sh/sh.c37
-rw-r--r--gcc/config/sh/sh.h15
-rw-r--r--gcc/config/sh/sh.md36
3 files changed, 18 insertions, 70 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 259e148..b17295f 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -3949,29 +3949,11 @@ sh_expand_prologue ()
that already happens to be at the function start into the prologue. */
if (target_flags != save_flags)
emit_insn (gen_toggle_sz ());
- if (flag_pic && (current_function_uses_pic_offset_table
- || regs_ever_live[PIC_OFFSET_TABLE_REGNUM]))
- {
- if ((live_regs_mask & (1 << PIC_OFFSET_TABLE_REGNUM)) != 0)
- abort ();
- d += UNITS_PER_WORD;
- live_regs_mask |= (1 << PIC_OFFSET_TABLE_REGNUM);
- }
+
push_regs (live_regs_mask, live_regs_mask2);
- if (flag_pic && (current_function_uses_pic_offset_table
- || regs_ever_live[PIC_OFFSET_TABLE_REGNUM]))
- {
- rtx insn = get_last_insn ();
- rtx insn_end = emit_insn (gen_GOTaddr2picreg ());
- while (insn != insn_end)
- {
- insn = NEXT_INSN (insn);
- REG_NOTES (insn) = gen_rtx_EXPR_LIST (REG_MAYBE_DEAD,
- const0_rtx,
- REG_NOTES (insn));
- }
- }
+ if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM])
+ emit_insn (gen_GOTaddr2picreg ());
if (target_flags != save_flags)
emit_insn (gen_toggle_sz ());
@@ -3997,14 +3979,6 @@ sh_expand_epilogue ()
live_regs_mask = calc_live_regs (&d, &live_regs_mask2);
- if (flag_pic && current_function_uses_pic_offset_table)
- {
- if ((live_regs_mask & (1 << PIC_OFFSET_TABLE_REGNUM)) != 0)
- abort ();
- live_regs_mask |= (1 << PIC_OFFSET_TABLE_REGNUM);
- d += UNITS_PER_WORD;
- }
-
frame_size = rounded_frame_size (d);
if (frame_pointer_needed)
@@ -4435,11 +4409,6 @@ initial_elimination_offset (from, to)
int live_regs_mask, live_regs_mask2;
live_regs_mask = calc_live_regs (&regs_saved, &live_regs_mask2);
- if (flag_pic && current_function_uses_pic_offset_table)
- {
- regs_saved++;
- live_regs_mask |= (1 << PIC_OFFSET_TABLE_REGNUM);
- }
total_auto_space = rounded_frame_size (regs_saved);
target_flags = save_flags;
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 9c516fc..b79a1fd 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -81,10 +81,7 @@ extern int code_for_indirect_jump_scratch;
} \
} \
if (flag_pic) \
- { \
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
- } \
+ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
/* Hitachi saves and restores mac registers on call. */ \
if (TARGET_HITACHI && ! TARGET_NOMACSAVE) \
{ \
@@ -1782,16 +1779,6 @@ do \
} \
while (0)
-#define FINALIZE_PIC \
- current_function_uses_pic_offset_table |= profile_flag | profile_block_flag
-
-/* We can't directly access anything that contains a symbol,
- nor can we indirect via the constant pool. */
-#define LEGITIMATE_PIC_OPERAND_P(X) \
- (! nonpic_symbol_mentioned_p (X) \
- && (! CONSTANT_POOL_ADDRESS_P (X) \
- || ! nonpic_symbol_mentioned_p (get_pool_constant (X))))
-
#define SYMBOLIC_CONST_P(X) \
((GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == LABEL_REF) \
&& nonpic_symbol_mentioned_p (X))
diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md
index 2c0ba5d..9e8e668 100644
--- a/gcc/config/sh/sh.md
+++ b/gcc/config/sh/sh.md
@@ -3502,7 +3502,6 @@
&& GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
{
emit_call_insn (gen_call_pcrel (XEXP (operands[0], 0), operands[1]));
- current_function_uses_pic_offset_table = 1;
DONE;
}
else
@@ -3524,7 +3523,6 @@
{
emit_call_insn (gen_call_value_pcrel (operands[0], XEXP (operands[1], 0),
operands[2]));
- current_function_uses_pic_offset_table = 1;
DONE;
}
else
@@ -3641,7 +3639,6 @@
"" "
{
operands[0] = pic_offset_table_rtx;
- current_function_uses_pic_offset_table = 1;
operands[1] = gen_rtx_SYMBOL_REF (VOIDmode, GOT_SYMBOL_NAME);
}
")
@@ -3674,7 +3671,6 @@
"
{
operands[2] = pic_offset_table_rtx;
- current_function_uses_pic_offset_table = 1;
}")
(define_expand "symGOTOFF2reg"
@@ -3685,7 +3681,6 @@
"
{
operands[2] = pic_offset_table_rtx;
- current_function_uses_pic_offset_table = 1;
}")
(define_expand "symPLT_label2reg"
@@ -3697,23 +3692,20 @@
(const (plus:SI
(match_operand:SI 2 "" "")
(const_int 2))))))
- (use (match_dup 3))]
- ;; Even though the PIC register is not really used by the call
- ;; sequence in which this is expanded, the PLT code assumes the PIC
- ;; register is set, so we must not skip its initialization. Since
- ;; we only use this expand as part of calling sequences, and never
- ;; to take the address of a function, this is the best point to
- ;; insert the (use). Using the PLT to take the address of a
- ;; function would be wrong, not only because the PLT entry could
- ;; then be called from a function that doesn't initialize the PIC
- ;; register to the proper GOT, but also because pointers to the same
- ;; function might not compare equal, should they be set by different
- ;; shared libraries.
- "" "
-{
- operands[3] = pic_offset_table_rtx;
- current_function_uses_pic_offset_table = 1;
-}")
+ ;; Even though the PIC register is not really used by the call
+ ;; sequence in which this is expanded, the PLT code assumes the PIC
+ ;; register is set, so we must not skip its initialization. Since
+ ;; we only use this expand as part of calling sequences, and never
+ ;; to take the address of a function, this is the best point to
+ ;; insert the (use). Using the PLT to take the address of a
+ ;; function would be wrong, not only because the PLT entry could
+ ;; then be called from a function that doesn't initialize the PIC
+ ;; register to the proper GOT, but also because pointers to the
+ ;; same function might not compare equal, should they be set by
+ ;; different shared libraries.
+ (use (reg:SI PIC_REG))]
+ ""
+ "")
;; case instruction for switch statements.