Commit b2471838 by Richard Sandiford Committed by Richard Sandiford

mips-protos.h (mips_initial_elimination_offset): Declare.

	* config/mips/mips-protos.h (mips_initial_elimination_offset): Declare.
	(mips_set_return_address, mips_restore_gp): Declare.
	* config/mips/mips.h (struct mips_frame_info): Move to mips.c
	(current_frame_info): Remove.
	(INITIAL_ELIMINATION_OFFSET): Use mips_initial_elimination_offset.
	* config/mips/mips.c: Remove uses of current_frame_info.
	(struct mips_frame_info): Moved from mips.h.  Remove 'insns_len'.
	(struct machine_function): Add 'frame' and 'insns_len'.
	(current_frame_info, zero_frame_info): Remove.
	(mips_restore_gp, mips_set_return_address): New.
	(mips_initial_elimination_offset): New.
	* config/mips/mips.md (exception_receiver): Use mips_restore_gp.
	(eh_return define_split): Use mips_set_return_address.

From-SVN: r54738
parent d3beaf0a
2002-06-18 Richard Sandiford <rsandifo@redhat.com>
* config/mips/mips-protos.h (mips_initial_elimination_offset): Declare.
(mips_set_return_address, mips_restore_gp): Declare.
* config/mips/mips.h (struct mips_frame_info): Move to mips.c
(current_frame_info): Remove.
(INITIAL_ELIMINATION_OFFSET): Use mips_initial_elimination_offset.
* config/mips/mips.c: Remove uses of current_frame_info.
(struct mips_frame_info): Moved from mips.h. Remove 'insns_len'.
(struct machine_function): Add 'frame' and 'insns_len'.
(current_frame_info, zero_frame_info): Remove.
(mips_restore_gp, mips_set_return_address): New.
(mips_initial_elimination_offset): New.
* config/mips/mips.md (exception_receiver): Use mips_restore_gp.
(eh_return define_split): Use mips_set_return_address.
2002-06-18 Neil Booth <neil@daikokuya.demon.co.uk>
* cpplib.c (dtable): Update.
......
......@@ -27,6 +27,7 @@ Boston, MA 02111-1307, USA. */
#define GCC_MIPS_PROTOS_H
extern HOST_WIDE_INT compute_frame_size PARAMS ((HOST_WIDE_INT));
extern int mips_initial_elimination_offset PARAMS ((int, int));
extern void mips_asm_file_end PARAMS ((FILE *));
extern void mips_asm_file_start PARAMS ((FILE *));
extern void iris6_asm_file_start PARAMS ((FILE *));
......@@ -86,6 +87,7 @@ extern void init_cumulative_args PARAMS ((CUMULATIVE_ARGS *,
tree, rtx));
extern void gen_conditional_move PARAMS ((rtx *));
extern void mips_gen_conditional_trap PARAMS ((rtx *));
extern void mips_set_return_address PARAMS ((rtx, rtx));
extern void machine_dependent_reorg PARAMS ((rtx));
extern int mips_address_cost PARAMS ((rtx));
extern void mips_count_memory_refs PARAMS ((rtx, int));
......@@ -96,6 +98,7 @@ extern const char *mips_fill_delay_slot PARAMS ((const char *,
rtx));
extern const char *mips_move_1word PARAMS ((rtx *, rtx, int));
extern const char *mips_move_2words PARAMS ((rtx *, rtx));
extern const char *mips_restore_gp PARAMS ((rtx *, rtx));
extern const char *output_block_move PARAMS ((rtx, rtx *, int,
enum block_move_type));
extern void override_options PARAMS ((void));
......
......@@ -2346,31 +2346,6 @@ extern enum reg_class mips_char_to_class[256];
#define TARGET_PTRMEMFUNC_VBIT_LOCATION ptrmemfunc_vbit_in_delta
/* Structure to be filled in by compute_frame_size with register
save masks, and offsets for the current function. */
struct mips_frame_info
{
long total_size; /* # bytes that the entire frame takes up */
long var_size; /* # bytes that variables take up */
long args_size; /* # bytes that outgoing arguments take up */
long extra_size; /* # bytes of extra gunk */
int gp_reg_size; /* # bytes needed to store gp regs */
int fp_reg_size; /* # bytes needed to store fp regs */
long mask; /* mask of saved gp registers */
long fmask; /* mask of saved fp registers */
long gp_save_offset; /* offset from vfp to store gp registers */
long fp_save_offset; /* offset from vfp to store fp registers */
long gp_sp_offset; /* offset from new sp to store gp registers */
long fp_sp_offset; /* offset from new sp to store fp registers */
int initialized; /* != 0 if frame size already calculated */
int num_gp; /* number of gp registers saved */
int num_fp; /* number of fp registers saved */
long insns_len; /* length of insns; mips16 only */
};
extern struct mips_frame_info current_frame_info;
/* If defined, this macro specifies a table of register pairs used to
eliminate unneeded registers that point into the stack frame. If
it is not defined, the only elimination attempted by the compiler
......@@ -2442,47 +2417,8 @@ extern struct mips_frame_info current_frame_info;
&& (! TARGET_MIPS16 \
|| compute_frame_size (get_frame_size ()) < 32768)))))
/* This macro is similar to `INITIAL_FRAME_POINTER_OFFSET'. It
specifies the initial difference between the specified pair of
registers. This macro must be defined if `ELIMINABLE_REGS' is
defined. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
{ compute_frame_size (get_frame_size ()); \
if (TARGET_MIPS16 && (FROM) == FRAME_POINTER_REGNUM \
&& (TO) == HARD_FRAME_POINTER_REGNUM) \
(OFFSET) = - current_function_outgoing_args_size; \
else if ((FROM) == FRAME_POINTER_REGNUM) \
(OFFSET) = 0; \
else if (TARGET_MIPS16 && (FROM) == ARG_POINTER_REGNUM \
&& (TO) == HARD_FRAME_POINTER_REGNUM) \
(OFFSET) = (current_frame_info.total_size \
- current_function_outgoing_args_size \
- ((mips_abi != ABI_32 \
&& mips_abi != ABI_O64 \
&& mips_abi != ABI_EABI) \
? current_function_pretend_args_size \
: 0)); \
else if ((FROM) == ARG_POINTER_REGNUM) \
(OFFSET) = (current_frame_info.total_size \
- ((mips_abi != ABI_32 \
&& mips_abi != ABI_O64 \
&& mips_abi != ABI_EABI) \
? current_function_pretend_args_size \
: 0)); \
/* Some ABIs store 64 bits to the stack, but Pmode is 32 bits, \
so we must add 4 bytes to the offset to get the right value. */ \
else if ((FROM) == RETURN_ADDRESS_POINTER_REGNUM) \
{ \
(OFFSET) = current_frame_info.gp_sp_offset \
+ ((UNITS_PER_WORD - (POINTER_SIZE / BITS_PER_UNIT)) \
* (BYTES_BIG_ENDIAN != 0)); \
if (TARGET_MIPS16 && (TO) != STACK_POINTER_REGNUM) \
(OFFSET) -= current_function_outgoing_args_size; \
} \
else \
abort(); \
}
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
(OFFSET) = mips_initial_elimination_offset ((FROM), (TO))
/* If we generate an insn to push BYTES bytes,
this says how many the stack pointer really advances by.
......
......@@ -10022,49 +10022,14 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\\n\\t%*j\\t%2"
[(const_int 0)]
"
{
HOST_WIDE_INT gp_offset;
rtx base;
compute_frame_size (get_frame_size ());
if (((current_frame_info.mask >> 31) & 1) == 0)
abort ();
gp_offset = current_frame_info.gp_sp_offset;
if (gp_offset < 32768)
base = stack_pointer_rtx;
else
{
base = operands[1];
emit_move_insn (base, GEN_INT (gp_offset));
if (Pmode == DImode)
emit_insn (gen_adddi3 (base, base, stack_pointer_rtx));
else
emit_insn (gen_addsi3 (base, base, stack_pointer_rtx));
gp_offset = 0;
}
emit_move_insn (gen_rtx_MEM (GET_MODE (operands[0]),
plus_constant (base, gp_offset)),
operands[0]);
mips_set_return_address (operands[0], operands[1]);
DONE;
}")
(define_insn "exception_receiver"
[(unspec_volatile [(const_int 0)] UNSPEC_EH_RECEIVER)]
"TARGET_ABICALLS && (mips_abi == ABI_32 || mips_abi == ABI_O64)"
"*
{
rtx loc;
operands[0] = pic_offset_table_rtx;
if (frame_pointer_needed)
loc = hard_frame_pointer_rtx;
else
loc = stack_pointer_rtx;
loc = plus_constant (loc, current_frame_info.args_size);
operands[1] = gen_rtx_MEM (Pmode, loc);
return mips_move_1word (operands, insn, 0);
}"
"* return mips_restore_gp (operands, insn);"
[(set_attr "type" "load")
(set_attr "length" "8")])
......
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