This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by thopre on Nov 22 2017, 10:38 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

thopre created this revision.Nov 22 2017, 10:38 AM

Ping? Would be nice to reduce complexity in this area.

Best regards.

thopre abandoned this revision.Feb 5 2019, 3:39 AM

No longer working for Arm. This would need to be rebased first if anybody picks it up.

Herald added a project: Restricted Project. · View Herald TranscriptFeb 5 2019, 3:39 AM