mips-protos.h (embedded_pic_fnaddr_reg): New.
* config/mips/mips-protos.h (embedded_pic_fnaddr_reg): New. * config/mips/mips.h (embedded_pic_fnaddr_rtx): Lose. (mips16_gp_pseudo_rtx): Lose. (INIT_EXPANDERS): Deleted. * config/mips/mips.c (mips_init_machine_status): New. (mips_free_machine_status): New. (mips_mark_machine_status): New. (override_options): Set them. (embedded_pic_fnaddr_rtx, mips16_gp_pseudo_rtx): Moved to... (struct machine_function): ... new. Replaced all references. (mips_add_gc_roots): Don't mark them. (embedded_pic_fnaddr_reg): New, extracted from... (embedded_pic_offset): ... here. * config/mips/mips.md (movdi): Call embedded_pic_fnaddr_reg. (movsi): Likewise. From-SVN: r50896
This commit is contained in:
parent
c2765075db
commit
c8d1b2b7b2
@ -1,3 +1,21 @@
|
||||
2002-03-16 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* config/mips/mips-protos.h (embedded_pic_fnaddr_reg): New.
|
||||
* config/mips/mips.h (embedded_pic_fnaddr_rtx): Lose.
|
||||
(mips16_gp_pseudo_rtx): Lose.
|
||||
(INIT_EXPANDERS): Deleted.
|
||||
* config/mips/mips.c (mips_init_machine_status): New.
|
||||
(mips_free_machine_status): New.
|
||||
(mips_mark_machine_status): New.
|
||||
(override_options): Set them.
|
||||
(embedded_pic_fnaddr_rtx, mips16_gp_pseudo_rtx): Moved to...
|
||||
(struct machine_function): ... new. Replaced all references.
|
||||
(mips_add_gc_roots): Don't mark them.
|
||||
(embedded_pic_fnaddr_reg): New, extracted from...
|
||||
(embedded_pic_offset): ... here.
|
||||
* config/mips/mips.md (movdi): Call embedded_pic_fnaddr_reg.
|
||||
(movsi): Likewise.
|
||||
|
||||
2002-03-16 Neil Booth <neil@daikokuya.demon.co.uk>
|
||||
|
||||
* cppinit.c: Revert -MD removal.
|
||||
|
@ -45,6 +45,7 @@ extern void mips_output_lineno PARAMS ((FILE *, int));
|
||||
extern void mips_output_ascii PARAMS ((FILE *, const char *,
|
||||
size_t));
|
||||
extern void mips_order_regs_for_local_alloc PARAMS ((void));
|
||||
extern struct rtx_def * embedded_pic_fnaddr_reg PARAMS ((void));
|
||||
extern struct rtx_def * mips16_gp_pseudo_reg PARAMS ((void));
|
||||
#ifdef ASM_OUTPUT_UNDEF_FUNCTION
|
||||
extern int mips_output_external_libcall PARAMS ((FILE *, const char *));
|
||||
|
@ -135,6 +135,22 @@ static int iris6_section_align_1 PARAMS ((void **, void *));
|
||||
#endif
|
||||
static int mips_adjust_cost PARAMS ((rtx, rtx, rtx, int));
|
||||
|
||||
static void mips_init_machine_status PARAMS ((struct function *));
|
||||
static void mips_free_machine_status PARAMS ((struct function *));
|
||||
static void mips_mark_machine_status PARAMS ((struct function *));
|
||||
|
||||
struct machine_function {
|
||||
/* Pseudo-reg holding the address of the current function when
|
||||
generating embedded PIC code. Created by LEGITIMIZE_ADDRESS,
|
||||
used by mips_finalize_pic if it was created. */
|
||||
rtx embedded_pic_fnaddr_rtx;
|
||||
|
||||
/* Pseudo-reg holding the value of $28 in a mips16 function which
|
||||
refers to GP relative global variables. */
|
||||
rtx mips16_gp_pseudo_rtx;
|
||||
};
|
||||
|
||||
|
||||
/* Global variables for machine-dependent things. */
|
||||
|
||||
/* Threshold for data being put into the small data/bss area, instead
|
||||
@ -293,21 +309,12 @@ struct mips_frame_info current_frame_info;
|
||||
/* Zero structure to initialize current_frame_info. */
|
||||
struct mips_frame_info zero_frame_info;
|
||||
|
||||
/* Pseudo-reg holding the address of the current function when
|
||||
generating embedded PIC code. Created by LEGITIMIZE_ADDRESS, used
|
||||
by mips_finalize_pic if it was created. */
|
||||
rtx embedded_pic_fnaddr_rtx;
|
||||
|
||||
/* The length of all strings seen when compiling for the mips16. This
|
||||
is used to tell how many strings are in the constant pool, so that
|
||||
we can see if we may have an overflow. This is reset each time the
|
||||
constant pool is output. */
|
||||
int mips_string_length;
|
||||
|
||||
/* Pseudo-reg holding the value of $28 in a mips16 function which
|
||||
refers to GP relative global variables. */
|
||||
rtx mips16_gp_pseudo_rtx;
|
||||
|
||||
/* In mips16 mode, we build a list of all the string constants we see
|
||||
in a particular function. */
|
||||
|
||||
@ -1828,19 +1835,18 @@ mips_count_memory_refs (op, num)
|
||||
}
|
||||
|
||||
|
||||
/* Return RTL for the offset from the current function to the argument.
|
||||
|
||||
??? Which argument is this? */
|
||||
/* Return a pseudo that points to the address of the current function.
|
||||
The first time it is called for a function, an initializer for the
|
||||
pseudo is emitted in the beginning of the function. */
|
||||
|
||||
rtx
|
||||
embedded_pic_offset (x)
|
||||
rtx x;
|
||||
embedded_pic_fnaddr_reg ()
|
||||
{
|
||||
if (embedded_pic_fnaddr_rtx == NULL)
|
||||
if (cfun->machine->embedded_pic_fnaddr_rtx == NULL)
|
||||
{
|
||||
rtx seq;
|
||||
|
||||
embedded_pic_fnaddr_rtx = gen_reg_rtx (Pmode);
|
||||
cfun->machine->embedded_pic_fnaddr_rtx = gen_reg_rtx (Pmode);
|
||||
|
||||
/* Output code at function start to initialize the pseudo-reg. */
|
||||
/* ??? We used to do this in FINALIZE_PIC, but that does not work for
|
||||
@ -1851,7 +1857,7 @@ embedded_pic_offset (x)
|
||||
initialize this value every time a function is inlined into another
|
||||
function. */
|
||||
start_sequence ();
|
||||
emit_insn (gen_get_fnaddr (embedded_pic_fnaddr_rtx,
|
||||
emit_insn (gen_get_fnaddr (cfun->machine->embedded_pic_fnaddr_rtx,
|
||||
XEXP (DECL_RTL (current_function_decl), 0)));
|
||||
seq = gen_sequence ();
|
||||
end_sequence ();
|
||||
@ -1860,6 +1866,19 @@ embedded_pic_offset (x)
|
||||
pop_topmost_sequence ();
|
||||
}
|
||||
|
||||
return cfun->machine->embedded_pic_fnaddr_rtx;
|
||||
}
|
||||
|
||||
/* Return RTL for the offset from the current function to the argument.
|
||||
X is the symbol whose offset from the current function we want. */
|
||||
|
||||
rtx
|
||||
embedded_pic_offset (x)
|
||||
rtx x;
|
||||
{
|
||||
/* Make sure it is emitted. */
|
||||
embedded_pic_fnaddr_reg ();
|
||||
|
||||
return
|
||||
gen_rtx_CONST (Pmode,
|
||||
gen_rtx_MINUS (Pmode, x,
|
||||
@ -5281,6 +5300,42 @@ override_options ()
|
||||
|
||||
/* Register global variables with the garbage collector. */
|
||||
mips_add_gc_roots ();
|
||||
|
||||
/* Functions to allocate, mark and deallocate machine-dependent
|
||||
function status. */
|
||||
init_machine_status = &mips_init_machine_status;
|
||||
free_machine_status = &mips_free_machine_status;
|
||||
mark_machine_status = &mips_mark_machine_status;
|
||||
}
|
||||
|
||||
/* Allocate a chunk of memory for per-function machine-dependent data. */
|
||||
static void
|
||||
mips_init_machine_status (fn)
|
||||
struct function *fn;
|
||||
{
|
||||
fn->machine = ((struct machine_function *)
|
||||
xcalloc (1, sizeof (struct machine_function)));
|
||||
}
|
||||
|
||||
/* Release the chunk of memory for per-function machine-dependent data. */
|
||||
static void
|
||||
mips_free_machine_status (fn)
|
||||
struct function *fn;
|
||||
{
|
||||
free (fn->machine);
|
||||
fn->machine = NULL;
|
||||
}
|
||||
|
||||
/* Mark per-function machine-dependent data. */
|
||||
static void
|
||||
mips_mark_machine_status (fn)
|
||||
struct function *fn;
|
||||
{
|
||||
if (fn->machine)
|
||||
{
|
||||
ggc_mark_rtx (fn->machine->embedded_pic_fnaddr_rtx);
|
||||
ggc_mark_rtx (fn->machine->mips16_gp_pseudo_rtx);
|
||||
}
|
||||
}
|
||||
|
||||
/* On the mips16, we want to allocate $24 (T_REG) before other
|
||||
@ -8226,13 +8281,13 @@ mips_secondary_reload_class (class, mode, x, in_p)
|
||||
rtx
|
||||
mips16_gp_pseudo_reg ()
|
||||
{
|
||||
if (mips16_gp_pseudo_rtx == NULL_RTX)
|
||||
if (cfun->machine->mips16_gp_pseudo_rtx == NULL_RTX)
|
||||
{
|
||||
rtx const_gp;
|
||||
rtx insn, scan;
|
||||
|
||||
mips16_gp_pseudo_rtx = gen_reg_rtx (Pmode);
|
||||
RTX_UNCHANGING_P (mips16_gp_pseudo_rtx) = 1;
|
||||
cfun->machine->mips16_gp_pseudo_rtx = gen_reg_rtx (Pmode);
|
||||
RTX_UNCHANGING_P (cfun->machine->mips16_gp_pseudo_rtx) = 1;
|
||||
|
||||
/* We want to initialize this to a value which gcc will believe
|
||||
is constant. */
|
||||
@ -8240,7 +8295,8 @@ mips16_gp_pseudo_reg ()
|
||||
gen_rtx (REG, Pmode, GP_REG_FIRST + 28));
|
||||
|
||||
start_sequence ();
|
||||
emit_move_insn (mips16_gp_pseudo_rtx, const_gp);
|
||||
emit_move_insn (cfun->machine->mips16_gp_pseudo_rtx,
|
||||
const_gp);
|
||||
insn = gen_sequence ();
|
||||
end_sequence ();
|
||||
|
||||
@ -8257,7 +8313,7 @@ mips16_gp_pseudo_reg ()
|
||||
pop_topmost_sequence ();
|
||||
}
|
||||
|
||||
return mips16_gp_pseudo_rtx;
|
||||
return cfun->machine->mips16_gp_pseudo_rtx;
|
||||
}
|
||||
|
||||
/* Return an RTX which represents the signed 16 bit offset from the
|
||||
@ -9834,8 +9890,6 @@ mips_add_gc_roots ()
|
||||
ggc_add_rtx_root (&mips_load_reg3, 1);
|
||||
ggc_add_rtx_root (&mips_load_reg4, 1);
|
||||
ggc_add_rtx_root (branch_cmp, ARRAY_SIZE (branch_cmp));
|
||||
ggc_add_rtx_root (&embedded_pic_fnaddr_rtx, 1);
|
||||
ggc_add_rtx_root (&mips16_gp_pseudo_rtx, 1);
|
||||
}
|
||||
|
||||
static enum processor_type
|
||||
|
@ -166,9 +166,7 @@ extern struct rtx_def *mips_load_reg; /* register to check for load delay */
|
||||
extern struct rtx_def *mips_load_reg2; /* 2nd reg to check for load delay */
|
||||
extern struct rtx_def *mips_load_reg3; /* 3rd reg to check for load delay */
|
||||
extern struct rtx_def *mips_load_reg4; /* 4th reg to check for load delay */
|
||||
extern struct rtx_def *embedded_pic_fnaddr_rtx; /* function address */
|
||||
extern int mips_string_length; /* length of strings for mips16 */
|
||||
extern struct rtx_def *mips16_gp_pseudo_rtx; /* psuedo reg holding $gp */
|
||||
|
||||
/* Functions to change what output section we are using. */
|
||||
extern void rdata_section PARAMS ((void));
|
||||
@ -2017,15 +2015,6 @@ extern char mips_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
|
||||
#define PIC_OFFSET_TABLE_REGNUM (GP_REG_FIRST + 28)
|
||||
|
||||
#define PIC_FUNCTION_ADDR_REGNUM (GP_REG_FIRST + 25)
|
||||
|
||||
/* Initialize embedded_pic_fnaddr_rtx before RTL generation for
|
||||
each function. We used to do this in FINALIZE_PIC, but FINALIZE_PIC
|
||||
isn't always called for static inline functions. */
|
||||
#define INIT_EXPANDERS \
|
||||
do { \
|
||||
embedded_pic_fnaddr_rtx = NULL; \
|
||||
mips16_gp_pseudo_rtx = NULL; \
|
||||
} while (0)
|
||||
|
||||
/* Define the classes of registers for register constraints in the
|
||||
machine description. Also define ranges of constants.
|
||||
|
@ -4945,7 +4945,7 @@ move\\t%0,%z4\\n\\
|
||||
rtx temp;
|
||||
|
||||
temp = embedded_pic_offset (operands[1]);
|
||||
temp = gen_rtx_PLUS (Pmode, embedded_pic_fnaddr_rtx,
|
||||
temp = gen_rtx_PLUS (Pmode, embedded_pic_fnaddr_reg (),
|
||||
force_reg (DImode, temp));
|
||||
emit_move_insn (operands[0], force_reg (DImode, temp));
|
||||
DONE;
|
||||
@ -5371,7 +5371,7 @@ move\\t%0,%z4\\n\\
|
||||
rtx temp;
|
||||
|
||||
temp = embedded_pic_offset (operands[1]);
|
||||
temp = gen_rtx_PLUS (Pmode, embedded_pic_fnaddr_rtx,
|
||||
temp = gen_rtx_PLUS (Pmode, embedded_pic_fnaddr_reg (),
|
||||
force_reg (SImode, temp));
|
||||
emit_move_insn (operands[0], force_reg (SImode, temp));
|
||||
DONE;
|
||||
|
Loading…
Reference in New Issue
Block a user