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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37731
138bc75d-0d04-0410-961f-
82ee72b054a4
+2000-11-25 Alexandre Oliva <aoliva@redhat.com>
+
+ * 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.
+
2000-11-25 Alexandre Oliva <aoliva@redhat.com>, NIIBE Yutaka <gniibe@m17n.org>
* config/sh/sh-protos.h (symbol_ref_operand): Declare.
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 ());
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)
int live_regs_mask, live_regs_mask2;
live_regs_mask = calc_live_regs (®s_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;
} \
} \
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) \
{ \
} \
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))
&& 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
{
emit_call_insn (gen_call_value_pcrel (operands[0], XEXP (operands[1], 0),
operands[2]));
- current_function_uses_pic_offset_table = 1;
DONE;
}
else
"" "
{
operands[0] = pic_offset_table_rtx;
- current_function_uses_pic_offset_table = 1;
operands[1] = gen_rtx_SYMBOL_REF (VOIDmode, GOT_SYMBOL_NAME);
}
")
"
{
operands[2] = pic_offset_table_rtx;
- current_function_uses_pic_offset_table = 1;
}")
(define_expand "symGOTOFF2reg"
"
{
operands[2] = pic_offset_table_rtx;
- current_function_uses_pic_offset_table = 1;
}")
(define_expand "symPLT_label2reg"
(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.