[PATCH] D49364: [ARM] Add support for spilling high registers in Thumb1

Petr Pavlu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 7 06:00:58 PST 2018


petpav01 updated this revision to Diff 172930.
petpav01 edited the summary of this revision.
petpav01 added a comment.
Herald added a subscriber: dexonsmith.

Updated patch improves the RegAllocFast part and adds more testing for it. InlineSpiller has no new changes.

Description of the changes:

- Code to allocate an intermediary register for the spill is moved to `RegAllocFast::handleIntermediarySpill()`.
- `RegAllocFast::allocVirtReg()` is split into `allocVirtReg()` and `assignVirtReg()`. The former method still does most of the allocation work but leaves final update of `PhysRegState` + `LRI->PhysReg` and error reporting to `assignVirtReg()`. This allows `handleIntermediarySpill()` to call `allocVirtReg()` to get a free register without updating other state.
- Spilling all registers prior to a call instruction in `RegAllocFast::allocateBasicBlock()` is moved before clearing of `UsedInInstr` so an intermediary does not get allocated to a register used by the instruction.

This is still not a complete patch. Known problems are:

- `handleIntermediarySpill()` does not always correctly update debug information (`DBG_VALUE`s).
- InlineSpiller still has the same problems as mentioned previously and needs more work.
- Changes implemented in SparseSet are currently without testing.

Any feedback on this is very welcome, especially whether the overall approach looks sensible or if some different idea would be preferable and better.

Note: There is a ongoing rewrite of RegAllocFast in https://reviews.llvm.org/D52010 which means this patch will need to be somewhat reworked after the rewrite lands but I do not think it should affect the basic idea that is implemented here.


https://reviews.llvm.org/D49364

Files:
  include/llvm/ADT/SparseSet.h
  include/llvm/CodeGen/LiveRangeEdit.h
  include/llvm/CodeGen/TargetInstrInfo.h
  lib/CodeGen/InlineSpiller.cpp
  lib/CodeGen/LiveRangeEdit.cpp
  lib/CodeGen/RegAllocFast.cpp
  lib/Target/ARM/Thumb1InstrInfo.cpp
  lib/Target/ARM/Thumb1InstrInfo.h
  test/CodeGen/Thumb/hgpr-spill-basic.mir
  test/CodeGen/Thumb/hgpr-spill-fast-all.mir
  test/CodeGen/Thumb/hgpr-spill-fast-tsave.mir
  test/CodeGen/Thumb/hgpr-spill-fast-tsave2.mir
  test/CodeGen/Thumb/hgpr-spill-fast.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49364.172930.patch
Type: text/x-patch
Size: 52273 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181107/5a031231/attachment.bin>


More information about the llvm-commits mailing list