[llvm] r264331 - [Hexagon] Be sure to treat subregisters of a CSR as CSRs as well
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 24 13:31:41 PDT 2016
Author: kparzysz
Date: Thu Mar 24 15:31:41 2016
New Revision: 264331
URL: http://llvm.org/viewvc/llvm-project?rev=264331&view=rev
Log:
[Hexagon] Be sure to treat subregisters of a CSR as CSRs as well
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonFrameLowering.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonFrameLowering.cpp?rev=264331&r1=264330&r2=264331&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonFrameLowering.cpp Thu Mar 24 15:31:41 2016
@@ -234,7 +234,8 @@ namespace {
/// Checks if the basic block contains any instruction that needs a stack
/// frame to be already in place.
- bool needsStackFrame(const MachineBasicBlock &MBB, const BitVector &CSR) {
+ bool needsStackFrame(const MachineBasicBlock &MBB, const BitVector &CSR,
+ const HexagonRegisterInfo &HRI) {
for (auto &I : MBB) {
const MachineInstr *MI = &I;
if (MI->isCall())
@@ -263,8 +264,9 @@ namespace {
// a stack slot.
if (TargetRegisterInfo::isVirtualRegister(R))
return true;
- if (CSR[R])
- return true;
+ for (MCSubRegIterator S(R, &HRI, true); S.isValid(); ++S)
+ if (CSR[*S])
+ return true;
}
}
return false;
@@ -335,10 +337,11 @@ void HexagonFrameLowering::findShrunkPro
SmallVector<MachineBasicBlock*,16> SFBlocks;
BitVector CSR(Hexagon::NUM_TARGET_REGS);
for (const MCPhysReg *P = HRI.getCalleeSavedRegs(&MF); *P; ++P)
- CSR[*P] = true;
+ for (MCSubRegIterator S(*P, &HRI, true); S.isValid(); ++S)
+ CSR[*S] = true;
for (auto &I : MF)
- if (needsStackFrame(I, CSR))
+ if (needsStackFrame(I, CSR, HRI))
SFBlocks.push_back(&I);
DEBUG({
More information about the llvm-commits
mailing list