* config/arm/arm.h (struct machine_function): Remove ra_rtx.
* config/arm/arm.c (arm_mark_machine_status): Remove ra_rtx.
(arm_return_addr): Use get_hard_reg_initial_val et al.
* config/d30v/d30v.h (struct machine_function): Remove ra_rtx.
* config/d30v/d30v.c (d30v_mark_machine_status): Remove ra_rtx.
(d30v_return_addr): Use get_hard_reg_initial_val et al.
* config/rs6000/rs6000.h (struct machine_function): Remove ra_rtx.
* config/rs6000/rs6000.c (rs6000_override_options): Don't set
mark_machine_status.
(rs6000_mark_machine_status): Remove.
(rs6000_return_addr): Use get_hard_reg_initial_val.
(rs6000_ra_ever_killed): Use has_hard_reg_initial_val.
* config/v850/v850.h (INIT_EXPANDERS): Delete.
* config/v850/v850.c (struct machine_function): Delete.
(v850_init_machine_status): Delete.
(v850_mark_machine_status): Delete.
(v850_free_machine_status): Delete.
(v850_return_addr): Use get_hard_reg_initial_val.
(v850_init_expanders): Delete.
From-SVN: r43507
+2001-06-22 DJ Delorie <dj@redhat.com>
+
+ * config/arm/arm.h (struct machine_function): Remove ra_rtx.
+ * config/arm/arm.c (arm_mark_machine_status): Remove ra_rtx.
+ (arm_return_addr): Use get_hard_reg_initial_val et al.
+ * config/d30v/d30v.h (struct machine_function): Remove ra_rtx.
+ * config/d30v/d30v.c (d30v_mark_machine_status): Remove ra_rtx.
+ (d30v_return_addr): Use get_hard_reg_initial_val et al.
+ * config/rs6000/rs6000.h (struct machine_function): Remove ra_rtx.
+ * config/rs6000/rs6000.c (rs6000_override_options): Don't set
+ mark_machine_status.
+ (rs6000_mark_machine_status): Remove.
+ (rs6000_return_addr): Use get_hard_reg_initial_val.
+ (rs6000_ra_ever_killed): Use has_hard_reg_initial_val.
+ * config/v850/v850.h (INIT_EXPANDERS): Delete.
+ * config/v850/v850.c (struct machine_function): Delete.
+ (v850_init_machine_status): Delete.
+ (v850_mark_machine_status): Delete.
+ (v850_free_machine_status): Delete.
+ (v850_return_addr): Use get_hard_reg_initial_val.
+ (v850_init_expanders): Delete.
+
Fri Jun 22 19:20:59 CEST 2001 Jan Hubicka <jh@suse.cz>
* predict.c (estimate_bb_frequencies): Do not handle conditional
machine_function *machine = p->machine;
if (machine)
- {
- ggc_mark_rtx (machine->ra_rtx);
- ggc_mark_rtx (machine->eh_epilogue_sp_ofs);
- }
+ ggc_mark_rtx (machine->eh_epilogue_sp_ofs);
}
static void
int count;
rtx frame ATTRIBUTE_UNUSED;
{
- rtx reg;
-
if (count != 0)
return NULL_RTX;
- reg = cfun->machine->ra_rtx;
-
- if (reg == NULL)
+ if (TARGET_APCS_32)
+ return get_hard_reg_initial_val (Pmode, LR_REGNUM);
+ else
{
- rtx init;
-
- /* No rtx yet. Invent one, and initialize it for r14 (lr) in
- the prologue. */
- reg = gen_reg_rtx (Pmode);
- cfun->machine->ra_rtx = reg;
-
- if (!TARGET_APCS_32)
- init = gen_rtx_AND (Pmode, gen_rtx_REG (Pmode, LR_REGNUM),
+ rtx lr = gen_rtx_AND (Pmode, gen_rtx_REG (Pmode, LR_REGNUM),
GEN_INT (RETURN_ADDR_MASK26));
- else
- init = gen_rtx_REG (Pmode, LR_REGNUM);
-
- init = gen_rtx_SET (VOIDmode, reg, init);
-
- /* Emit the insn to the prologue with the other argument copies. */
- push_topmost_sequence ();
- emit_insn_after (init, get_insns ());
- pop_topmost_sequence ();
+ return get_func_hard_reg_initial_val (cfun, lr);
}
-
- return reg;
}
/* Do anything needed before RTL is emitted for each function. */
This is added to the cfun structure. */
typedef struct machine_function
{
- /* Records __builtin_return address. */
- struct rtx_def *ra_rtx;
/* Additionsl stack adjustment in __builtin_eh_throw. */
struct rtx_def *eh_epilogue_sp_ofs;
/* Records if LR has to be saved for far jumps. */
if (p->machine == NULL)
return;
- ggc_mark_rtx (p->machine->ra_rtx);
ggc_mark_rtx (p->machine->eh_epilogue_sp_ofs);
}
rtx
d30v_return_addr ()
{
- rtx ret;
-
- ret = cfun->machine->ra_rtx;
-
- if (ret == NULL)
- {
- rtx init;
-
- cfun->machine->ra_rtx = ret = gen_reg_rtx (Pmode);
-
- init = gen_rtx (SET, VOIDmode, ret, gen_rtx (REG, Pmode, GPR_LINK));
- push_topmost_sequence ();
- emit_insn_after (init, get_insns ());
- pop_topmost_sequence ();
- }
-
- return ret;
+ return get_hard_reg_initial_val (Pmode, GPR_LINK);
}
/* Called to register all of our global variables with the garbage
{
/* Additionsl stack adjustment in __builtin_eh_throw. */
struct rtx_def * eh_epilogue_sp_ofs;
- /* Records __builtin_return address. */
- struct rtx_def * ra_rtx;
} machine_function;
\f
static int constant_pool_expr_1 PARAMS ((rtx, int *, int *));
static void rs6000_free_machine_status PARAMS ((struct function *));
static void rs6000_init_machine_status PARAMS ((struct function *));
-static void rs6000_mark_machine_status PARAMS ((struct function *));
static int rs6000_ra_ever_killed PARAMS ((void));
\f
/* Default register names. */
/* Arrange to save and restore machine status around nested functions. */
init_machine_status = rs6000_init_machine_status;
- mark_machine_status = rs6000_mark_machine_status;
free_machine_status = rs6000_free_machine_status;
}
p->machine = (machine_function *) xcalloc (1, sizeof (machine_function));
}
-static void
-rs6000_mark_machine_status (p)
- struct function *p;
-{
- if (p->machine)
- ggc_mark_rtx (p->machine->ra_rtx);
-}
-
static void
rs6000_free_machine_status (p)
struct function *p;
int count;
rtx frame;
{
- rtx init, reg;
-
/* Currently we don't optimize very well between prolog and body code and
for PIC code the code can be actually quite bad, so don't try to be
too clever here. */
RETURN_ADDRESS_OFFSET)));
}
- reg = cfun->machine->ra_rtx;
- if (reg == NULL)
- {
- /* No rtx yet. Invent one, and initialize it from LR in
- the prologue. */
- reg = gen_reg_rtx (Pmode);
- cfun->machine->ra_rtx = reg;
- init = gen_rtx_SET (VOIDmode, reg,
- gen_rtx_REG (Pmode, LINK_REGISTER_REGNUM));
-
- /* Emit the insn to the prologue with the other argument copies. */
- push_topmost_sequence ();
- emit_insn_after (init, get_insns ());
- pop_topmost_sequence ();
- }
-
- return reg;
+ return get_hard_reg_initial_val (Pmode, LINK_REGISTER_REGNUM);
}
static int
if (current_function_is_thunk)
return 0;
#endif
- if (!cfun->machine->ra_rtx || cfun->machine->ra_needs_full_frame)
+ if (!has_hard_reg_initial_val (Pmode, LINK_REGISTER_REGNUM)
+ || cfun->machine->ra_needs_full_frame)
return regs_ever_live[LINK_REGISTER_REGNUM];
push_topmost_sequence ();
{
/* Whether a System V.4 varargs area was created. */
int sysv_varargs_p;
- /* Set if a return address rtx for loading from LR was created. */
- struct rtx_def *ra_rtx;
/* Flags if __builtin_return_address (n) with n >= 1 was used. */
int ra_needs_full_frame;
} machine_function;
static void substitute_ep_register PARAMS ((rtx, rtx, int, int, rtx *, rtx *));
static int ep_memory_offset PARAMS ((enum machine_mode, int));
static void v850_set_data_area PARAMS ((tree, v850_data_area));
-static void v850_init_machine_status PARAMS ((struct function *));
-static void v850_mark_machine_status PARAMS ((struct function *));
-static void v850_free_machine_status PARAMS ((struct function *));
/* True if the current function has anonymous arguments. */
int current_function_anonymous_args;
return addr_rtx;
}
\f
-/* Functions to save and restore machine-specific function data. */
-struct machine_function
-{
- /* Records __builtin_return address. */
- struct rtx_def * ra_rtx;
-};
-
-static void
-v850_init_machine_status (p)
- struct function * p;
-{
- p->machine =
- (struct machine_function *) xcalloc (1, sizeof (struct machine_function));
-}
-
-static void
-v850_mark_machine_status (p)
- struct function * p;
-{
- ggc_mark_rtx (p->machine->ra_rtx);
-}
-
-static void
-v850_free_machine_status (p)
- struct function * p;
-{
- free (p->machine);
- p->machine = NULL;
-}
-
/* Return an RTX indicating where the return address to the
calling function can be found. */
if (count != 0)
return const0_rtx;
- if (cfun->machine->ra_rtx == NULL)
- {
- rtx init;
-
- /* No rtx yet. Invent one, and initialize it for r31 (lp) in
- the prologue. */
- cfun->machine->ra_rtx = gen_reg_rtx (Pmode);
-
- init = gen_rtx_REG (Pmode, LINK_POINTER_REGNUM);
-
- init = gen_rtx_SET (VOIDmode, cfun->machine->ra_rtx, init);
-
- /* Emit the insn to the prologue with the other argument copies. */
- push_topmost_sequence ();
- emit_insn_after (init, get_insns ());
- pop_topmost_sequence ();
- }
-
- return cfun->machine->ra_rtx;
-}
-
-/* Do anything needed before RTL is emitted for each function. */
-
-void
-v850_init_expanders ()
-{
- init_machine_status = v850_init_machine_status;
- mark_machine_status = v850_mark_machine_status;
- free_machine_status = v850_free_machine_status;
+ return get_hard_reg_initial_val (Pmode, LINK_POINTER_REGNUM);
}
#define EXIT_IGNORE_STACK 1
-/* Initialize data used by insn expanders. This is called from insn_emit,
- once for every function before code is generated. */
-#define INIT_EXPANDERS v850_init_expanders ()
-
/* Output assembler code to FILE to increment profiler label # LABELNO
for profiling a function entry. */