Context
This patch is part of a patch series to make code for spilling/restoring
callee-saved register more data driven and with less code duplication.
Its purpose is to consolidate the relation between registers and the
spill area they belong into a single function.
Patch description
To decide what registers should be pushed/popped together,
emitPushInst() and emitPopInst() take a function pointer parameter that
return true if a given register should be pushed. ARMBaseRegisterInfo.h
has then one such function for each spill area on the stack.
While whether a register is part of a spill area is mostly static, there
is a bit of variation depending on the target and some per-function
parameter. This lead to quite a bit of code duplication. Having
different functions also forces the caller to be spill area dependent,
eg. it prevents computing the size of each spill areas in a generic way.
This patch introduces an enumeration describing the set of spill areas
and creates a unique function that return to which spill area a given
register belong. It then makes use of it to simplify the code in
ARMFrameLowering in the following way:
- remove duplication of association between registers and spill area when computing size of each spill area
- likewise when emitting frame debug info
- remove logic to distinguish between DPRCS1 and DPRCS2 spill area in many places
All in all, knowledge of link between registers and spill area is now
more centralized and code is smaller: 81 insertions for 125 deletions.
Testing: Ran llvm_regr which shows no regression.