Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/gcc/config/or1k/or1k-protos.h b/gcc/config/or1k/or1k-protos.h
- index d4a2533..68a2954 100644
- --- a/gcc/config/or1k/or1k-protos.h
- +++ b/gcc/config/or1k/or1k-protos.h
- @@ -26,6 +26,7 @@ extern int or1k_trampoline_code_size (void);
- /* The following are only needed when handling the machine definition. */
- #ifdef RTX_CODE
- +extern void or1k_init_expanders (void);
- extern void or1k_expand_prologue (void);
- extern void or1k_expand_epilogue (void);
- extern bool or1k_expand_move (enum machine_mode mode, rtx operands[]);
- diff --git a/gcc/config/or1k/or1k.c b/gcc/config/or1k/or1k.c
- index 88e0e07..646eae0 100644
- --- a/gcc/config/or1k/or1k.c
- +++ b/gcc/config/or1k/or1k.c
- @@ -134,7 +134,8 @@ or1k_save_reg_p (int regno)
- /* We need to save the incoming return address if it is ever clobbered
- within the function. */
- if (regno == LINK_REGNUM
- - && (df_regs_ever_live_p(regno) || crtl->uses_pic_offset_table))
- + && (df_regs_ever_live_p(regno) || crtl->uses_pic_offset_table
- + || cfun->machine->force_lr_save))
- return true;
- if(crtl->calls_eh_return)
- @@ -2123,15 +2124,14 @@ or1k_return_addr_rtx (int count, rtx frame ATTRIBUTE_UNUSED)
- if (count != 0)
- return const0_rtx;
- - or1k_compute_frame_size (get_frame_size ());
- + /* We don't know if LR is going to be saved or if we're going to
- + * be clobbering it with the GOT instruction.
- + * Therefore the safest bet is to force a save of LR and use that.
- + * Assume it's going to be first in the stack. */
- - /* If we clobber the LR register, we should have saved it.
- - * If we didn't save it - assume it's still in LR */
- - if (frame_info.save_lr_p)
- - return gen_rtx_MEM (Pmode, plus_constant (Pmode, arg_pointer_rtx,
- - frame_info.lr_save_offset));
- - else
- - return get_hard_reg_initial_val (Pmode, LINK_REGNUM);
- + cfun->machine->force_lr_save = true;
- + return gen_rtx_MEM (Pmode, plus_constant (Pmode, arg_pointer_rtx,
- + -UNITS_PER_WORD));
- }
- /* Implement TARGET_FRAME_POINTER_REQUIRED.
- @@ -2142,6 +2142,26 @@ or1k_frame_pointer_required (void)
- return crtl->calls_eh_return || cfun->calls_alloca;
- }
- +/* Functions to save and restore machine-specific function data. */
- +static struct machine_function *
- +or1k_init_machine_status (void)
- +{
- + return ggc_alloc_cleared_machine_function ();
- +}
- +
- +void
- +or1k_init_expanders (void)
- +{
- + /* Arrange to initialize and mark the machine per-function
- + * status. */
- + init_machine_status = or1k_init_machine_status;
- +
- + if (cfun && cfun->machine)
- + {
- + cfun->machine->force_lr_save = false;
- + }
- +}
- +
- #undef TARGET_FRAME_POINTER_REQUIRED
- #define TARGET_FRAME_POINTER_REQUIRED or1k_frame_pointer_required
- diff --git a/gcc/config/or1k/or1k.h b/gcc/config/or1k/or1k.h
- index 50db43e..3b538fb 100644
- --- a/gcc/config/or1k/or1k.h
- +++ b/gcc/config/or1k/or1k.h
- @@ -1189,4 +1189,14 @@ enum reg_class
- #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, EH_RETURN_REGNUM)
- #define EH_RETURN_HANDLER_RTX or1k_eh_return_handler_rtx ()
- +#define INIT_EXPANDERS or1k_init_expanders ()
- +
- +/* A C structure for machine-specific, per-function data. This is
- + * added to the cfun structure. */
- +typedef struct GTY(()) machine_function
- +{
- + /* Force stack save of LR. Used in RETURN_ADDR_RTX. */
- + int force_lr_save;
- +} machine_function;
- +
- #endif /* _OR1K_H_ */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement