diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp b/contrib/llvm-project/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp index 37fd3e4853ac..5f54d7cc8472 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/LocalStackSlotAllocation.cpp @@ -23,7 +23,6 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineOperand.h" -#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/TargetFrameLowering.h" #include "llvm/CodeGen/TargetOpcodes.h" #include "llvm/CodeGen/TargetRegisterInfo.h" @@ -118,7 +117,7 @@ bool LocalStackSlotPass::runOnMachineFunction(MachineFunction &MF) { // If the target doesn't want/need this pass, or if there are no locals // to consider, early exit. if (LocalObjectCount == 0 || !TRI->requiresVirtualBaseRegisters(MF)) - return true; + return false; // Make sure we have enough space to store the local offsets. LocalOffsets.resize(MFI.getObjectIndexEnd()); @@ -344,7 +343,7 @@ bool LocalStackSlotPass::insertFrameReferenceRegisters(MachineFunction &Fn) { MachineBasicBlock *Entry = &Fn.front(); - unsigned BaseReg = 0; + Register BaseReg; int64_t BaseOffset = 0; // Loop through the frame references and allocate for them as necessary. @@ -414,20 +413,14 @@ bool LocalStackSlotPass::insertFrameReferenceRegisters(MachineFunction &Fn) { continue; } - const MachineFunction *MF = MI.getMF(); - const TargetRegisterClass *RC = TRI->getPointerRegClass(*MF); - BaseReg = Fn.getRegInfo().createVirtualRegister(RC); - - LLVM_DEBUG(dbgs() << " Materializing base register" - << " at frame local offset " - << LocalOffset + InstrOffset); - // Tell the target to insert the instruction to initialize // the base register. // MachineBasicBlock::iterator InsertionPt = Entry->begin(); BaseReg = TRI->materializeFrameBaseRegister(Entry, FrameIdx, InstrOffset); - LLVM_DEBUG(dbgs() << " into " << printReg(BaseReg, TRI) << '\n'); + LLVM_DEBUG(dbgs() << " Materialized base register at frame local offset " + << LocalOffset + InstrOffset + << " into " << printReg(BaseReg, TRI) << '\n'); // The base register already includes any offset specified // by the instruction, so account for that so it doesn't get @@ -437,7 +430,7 @@ bool LocalStackSlotPass::insertFrameReferenceRegisters(MachineFunction &Fn) { ++NumBaseRegisters; UsedBaseReg = true; } - assert(BaseReg != 0 && "Unable to allocate virtual base register!"); + assert(BaseReg && "Unable to allocate virtual base register!"); // Modify the instruction to use the new base register rather // than the frame index operand. |