[PATCH] D40367: [PATCH 1/2] Consolidate link between registers and spill area

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 10:39:40 PST 2017


thopre created this revision.
Herald added subscribers: kristof.beyls, javed.absar, aprantl, aemerson.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D40367

Files:
  lib/Target/ARM/ARMBaseRegisterInfo.h
  lib/Target/ARM/ARMFrameLowering.cpp
  lib/Target/ARM/ARMFrameLowering.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40367.123981.patch
Type: text/x-patch
Size: 13752 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171122/658f824c/attachment.bin>


More information about the llvm-commits mailing list