Skip to content

Commit d149631

Browse files
authored
[CodeGen] Add another method to CFIInstBuilder (#136270)
Mainly for use by downstream targets, but it can find applications in upstream code as well. Use it in MSP430 so that it doesn't look dead.
1 parent 802e730 commit d149631

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

llvm/include/llvm/CodeGen/CFIInstBuilder.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ class CFIInstBuilder {
7171
insertCFIInst(MCCFIInstruction::cfiDefCfaOffset(nullptr, Offset));
7272
}
7373

74+
void buildAdjustCFAOffset(int64_t Adjustment) const {
75+
insertCFIInst(MCCFIInstruction::createAdjustCfaOffset(nullptr, Adjustment));
76+
}
77+
7478
void buildOffset(MCRegister Reg, int64_t Offset) const {
7579
insertCFIInst(MCCFIInstruction::createOffset(
7680
nullptr, TRI.getDwarfRegNum(Reg, IsEH), Offset));

llvm/lib/Target/MSP430/MSP430FrameLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "MSP430InstrInfo.h"
1515
#include "MSP430MachineFunctionInfo.h"
1616
#include "MSP430Subtarget.h"
17+
#include "llvm/CodeGen/CFIInstBuilder.h"
1718
#include "llvm/CodeGen/MachineFrameInfo.h"
1819
#include "llvm/CodeGen/MachineFunction.h"
1920
#include "llvm/CodeGen/MachineInstrBuilder.h"
@@ -406,9 +407,8 @@ MachineBasicBlock::iterator MSP430FrameLowering::eliminateCallFramePseudoInstr(
406407
.addReg(MSP430::SP)
407408
.addImm(CalleeAmt);
408409
if (!hasFP(MF)) {
409-
DebugLoc DL = I->getDebugLoc();
410-
BuildCFI(MBB, I, DL,
411-
MCCFIInstruction::createAdjustCfaOffset(nullptr, CalleeAmt));
410+
CFIInstBuilder(MBB, I, MachineInstr::NoFlags)
411+
.buildAdjustCFAOffset(CalleeAmt);
412412
}
413413
// The SRW implicit def is dead.
414414
New->getOperand(3).setIsDead();

0 commit comments

Comments
 (0)