diff options
author | Oliver Stannard <oliver.stannard@linaro.org> | 2019-08-02 10:23:05 +0000 |
---|---|---|
committer | Oliver Stannard <oliver.stannard@linaro.org> | 2019-08-02 10:23:05 +0000 |
commit | f6b00c279a5587a25876752a6ecd8da0bed959dc (patch) | |
tree | e9984f3502ad3cdee3ec7e445cd4b5e1cc735a62 /llvm/lib/CodeGen/RegUsageInfoCollector.cpp | |
parent | de67affd005d2a4af3554ff48f874868f022a022 (diff) | |
download | llvm-f6b00c279a5587a25876752a6ecd8da0bed959dc.zip llvm-f6b00c279a5587a25876752a6ecd8da0bed959dc.tar.gz llvm-f6b00c279a5587a25876752a6ecd8da0bed959dc.tar.bz2 |
Fix and test inter-procedural register allocation for ARM
- Avoid a crash when IPRA calls ARMFrameLowering::determineCalleeSaves
with a null RegScavenger. Simply not updating the register scavenger
is fine because IPRA only cares about the SavedRegs vector, the acutal
code of the function has already been generated at this point.
- Add a new hook to TargetRegisterInfo to get the set of registers which
can be clobbered inside a call, even if the compiler can see both
sides, by linker-generated code.
Differential revision: https://reviews.llvm.org/D64908
llvm-svn: 367669
Diffstat (limited to 'llvm/lib/CodeGen/RegUsageInfoCollector.cpp')
-rw-r--r-- | llvm/lib/CodeGen/RegUsageInfoCollector.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/RegUsageInfoCollector.cpp b/llvm/lib/CodeGen/RegUsageInfoCollector.cpp index b37dfad..64552b5 100644 --- a/llvm/lib/CodeGen/RegUsageInfoCollector.cpp +++ b/llvm/lib/CodeGen/RegUsageInfoCollector.cpp @@ -142,6 +142,13 @@ bool RegUsageInfoCollector::runOnMachineFunction(MachineFunction &MF) { auto SetRegAsDefined = [&RegMask] (unsigned Reg) { RegMask[Reg / 32] &= ~(1u << Reg % 32); }; + + // Some targets can clobber registers "inside" a call, typically in + // linker-generated code. + for (const MCPhysReg Reg : TRI->getIntraCallClobberedRegs(&MF)) + for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI) + SetRegAsDefined(*AI); + // Scan all the physical registers. When a register is defined in the current // function set it and all the aliasing registers as defined in the regmask. // FIXME: Rewrite to use regunits. |