save = true;
/* Frame pointer marked used. */
- else if (frame_pointer_needed && reg == FRAME_POINTER_REGNUM)
+ else if (frame_pointer_needed && reg == HARD_FRAME_POINTER_REGNUM)
save = true;
/* This is required for CK801/802 where FP is a fixed reg, otherwise
we end up with no FP value available to the DWARF-2 unwinder. */
- else if (crtl->calls_eh_return && reg == FRAME_POINTER_REGNUM)
+ else if (crtl->calls_eh_return && reg == HARD_FRAME_POINTER_REGNUM)
save = true;
/* CK801/802 also need special handling for LR because it's clobbered
static bool
csky_can_eliminate (const int from ATTRIBUTE_UNUSED, const int to)
{
+ if (to == FRAME_POINTER_REGNUM)
+ return from != ARG_POINTER_REGNUM;
if (to == STACK_POINTER_REGNUM)
return !frame_pointer_needed;
return true;
switch (from)
{
case FRAME_POINTER_REGNUM:
+ case HARD_FRAME_POINTER_REGNUM:
offset = cfun->machine->reg_offset;
break;
/* If we are asked for the offset to the frame pointer instead,
then subtract the difference between the frame pointer and stack
pointer. */
- if (to == FRAME_POINTER_REGNUM)
+ if (to == FRAME_POINTER_REGNUM || to == HARD_FRAME_POINTER_REGNUM)
offset -= cfun->machine->reg_offset;
return offset;
}
of the register save area. */
if (frame_pointer_needed)
{
- insn = emit_insn (gen_movsi (frame_pointer_rtx, stack_pointer_rtx));
+ insn = emit_insn (gen_movsi (hard_frame_pointer_rtx, stack_pointer_rtx));
RTX_FRAME_RELATED_P (insn) = 1;
}
/* Restore the SP to the base of the register save area. */
if (frame_pointer_needed)
{
- insn = emit_move_insn (stack_pointer_rtx, frame_pointer_rtx);
+ insn = emit_move_insn (stack_pointer_rtx, hard_frame_pointer_rtx);
RTX_FRAME_RELATED_P (insn) = 1;
}
else
if (frame_pointer_needed)
{
- basereg = frame_pointer_rtx;
+ basereg = hard_frame_pointer_rtx;
delta = 0;
}
else
#define STACK_POINTER_REGNUM CSKY_SP_REGNUM
/* Base register for access to local variables of the function. */
-#define FRAME_POINTER_REGNUM 8
+#define FRAME_POINTER_REGNUM 36
+#define HARD_FRAME_POINTER_REGNUM 8
/* Base register for access to arguments of the function. This is a fake
register that is always eliminated. */
#define ELIMINABLE_REGS \
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM },\
{ ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM },\
- { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM }}
+ { ARG_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM },\
+ { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM },\
+ { FRAME_POINTER_REGNUM, HARD_FRAME_POINTER_REGNUM }}
/* Define the offset between two registers, one to be eliminated, and the
other its replacement, at the start of a routine. */