summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index bfa5ab274c68..69836ef27f8c 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -336,6 +336,16 @@ MachineFunction::addFrameInst(const MCCFIInstruction &Inst) {
return FrameInstructions.size() - 1;
}
+void MachineFunction::replaceFrameInstRegister(Register FromReg,
+ Register ToReg) {
+ const MCRegisterInfo *MCRI = Ctx.getRegisterInfo();
+ unsigned DwarfFromReg = MCRI->getDwarfRegNum(FromReg, false);
+ unsigned DwarfToReg = MCRI->getDwarfRegNum(ToReg, false);
+
+ for (MCCFIInstruction &Inst : FrameInstructions)
+ Inst.replaceRegister(DwarfFromReg, DwarfToReg);
+}
+
/// This discards all of the MachineBasicBlock numbers and recomputes them.
/// This guarantees that the MBB numbers are sequential, dense, and match the
/// ordering of the blocks within the function. If a specific MachineBasicBlock