cris: define HARD_FRAME_POINTER_REGNUM
authorHans-Peter Nilsson <hp@axis.com>
Thu, 11 Mar 2021 02:38:34 +0000 (03:38 +0100)
committerHans-Peter Nilsson <hp@axis.com>
Thu, 11 Mar 2021 02:43:48 +0000 (03:43 +0100)
commitaa27696b798b34730f5266cac2adba9178ebc3ae
treec31b33844b404d76ff180b28c60c192c48c1a3eb
parente9800852067503ed0fe4efbfcac5f172b8596ee6
cris: define HARD_FRAME_POINTER_REGNUM

Beware, tm.texi doesn't tell the whole story: a defined
HARD_FRAME_POINTER_REGNUM (different to FRAME_POINTER_REGNUM) is
supposed to make work easier for reload, being able to easily
tell actual frame-pointer-related addresses from those that
happen to use the same register or something to that effect.

On reasonable code the performance effect is barely measurable.

Looking at libgcc changes for -march=v10, the effect (where
noticeable) is mostly indeterminate churn.  Instances where it's
not just insns moved around at no obvious effect: one more insn
for addvdi3, subvdi3; two insns more in floatdisf; three insns
shorter fixunsdfdi.  Some of those seem related to pairing r8
with r9.  The only effect on coremark is an infinitesimal
positive effect from a three(!) cycles total (from the 15 calls)
faster execution paths in vfprintf_r.  Local microbenchmarks
give similar results.  With that in mind and not forgetting that
expectations in the register allocator and reload leaning
towards HARD_FRAME_POINTER_REGNUM defined (and different to)
FRAME_POINTER_REGNUM or to wit, "all the kids do it", why not.
Note that the offset at elimination really is 0.

gcc:
* config/cris/cris.h (HARD_FRAME_POINTER_REGNUM): Define.
Change FRAME_POINTER_REGNUM to correspond to a new faked
register faked_fp, part of GENNONACR_REGS like faked_ap.
(CRIS_FAKED_REGS_CONTENTS): New helper macro.
(FIRST_PSEUDO_REGISTER, FIXED_REGISTERS, CALL_USED_REGISTERS):
(REG_ALLOC_ORDER, REG_CLASS_CONTENTS, REGNO_OK_FOR_BASE_P)
(ELIMINABLE_REGS, REGISTER_NAMES): Adjust accordingly.
* config/cris/cris.md (CRIS_FP_REGNUM): Renumber to new faked
register.
(CRIS_REAL_FP_REGNUM): New constant.
* config/cris/cris.c (cris_reg_saved_in_regsave_area): Check
for HARD_FRAME_POINTER_REGNUM instead of FRAME_POINTER_REGNUM.
(cris_initial_elimination_offset): Handle elimination changes
to HARD_FRAME_POINTER_REGNUM instead of FRAME_POINTER_REGNUM
and add one from FRAME_POINTER_REGNUM to
HARD_FRAME_POINTER_REGNUM.
(cris_expand_prologue, cris_expand_epilogue): Emit code for
hard_frame_pointer_rtx instead of frame_pointer_rtx.
gcc/config/cris/cris.c
gcc/config/cris/cris.h
gcc/config/cris/cris.md