mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Move FrameInstructions from MachineModuleInfo to MachineFunction
This is per function data so it is better kept at the function instead of the module. This is a necessary step to have machine module passes work properly. Differential Revision: https://reviews.llvm.org/D27185 llvm-svn: 288291
This commit is contained in:
parent
c909de5624
commit
ced7bf3e1d
@ -25,6 +25,7 @@
|
||||
#include "llvm/CodeGen/MachineMemOperand.h"
|
||||
#include "llvm/IR/DebugLoc.h"
|
||||
#include "llvm/IR/Metadata.h"
|
||||
#include "llvm/MC/MCDwarf.h"
|
||||
#include "llvm/Support/Allocator.h"
|
||||
#include "llvm/Support/ArrayRecycler.h"
|
||||
#include "llvm/Support/Compiler.h"
|
||||
@ -245,6 +246,10 @@ class MachineFunction {
|
||||
// Allocation management for pseudo source values.
|
||||
std::unique_ptr<PseudoSourceValueManager> PSVManager;
|
||||
|
||||
/// List of moves done by a function's prolog. Used to construct frame maps
|
||||
/// by debug and exception handling consumers.
|
||||
std::vector<MCCFIInstruction> FrameInstructions;
|
||||
|
||||
MachineFunction(const MachineFunction &) = delete;
|
||||
void operator=(const MachineFunction&) = delete;
|
||||
|
||||
@ -640,6 +645,18 @@ public:
|
||||
/// getPICBaseSymbol - Return a function-local symbol to represent the PIC
|
||||
/// base.
|
||||
MCSymbol *getPICBaseSymbol() const;
|
||||
|
||||
/// Returns a reference to a list of cfi instructions in the function's
|
||||
/// prologue. Used to construct frame maps for debug and exception handling
|
||||
/// comsumers.
|
||||
const std::vector<MCCFIInstruction> &getFrameInstructions() const {
|
||||
return FrameInstructions;
|
||||
}
|
||||
|
||||
LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst) {
|
||||
FrameInstructions.push_back(Inst);
|
||||
return FrameInstructions.size() - 1;
|
||||
}
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
@ -122,10 +122,6 @@ class MachineModuleInfo : public ImmutablePass {
|
||||
/// want.
|
||||
MachineModuleInfoImpl *ObjFileMMI;
|
||||
|
||||
/// List of moves done by a function's prolog. Used to construct frame maps
|
||||
/// by debug and exception handling consumers.
|
||||
std::vector<MCCFIInstruction> FrameInstructions;
|
||||
|
||||
/// List of LandingPadInfo describing the landing pad information in the
|
||||
/// current function.
|
||||
std::vector<LandingPadInfo> LandingPads;
|
||||
@ -279,18 +275,6 @@ public:
|
||||
UsesMorestackAddr = b;
|
||||
}
|
||||
|
||||
/// Returns a reference to a list of cfi instructions in the current
|
||||
/// function's prologue. Used to construct frame maps for debug and
|
||||
/// exception handling comsumers.
|
||||
const std::vector<MCCFIInstruction> &getFrameInstructions() const {
|
||||
return FrameInstructions;
|
||||
}
|
||||
|
||||
LLVM_NODISCARD unsigned addFrameInst(const MCCFIInstruction &Inst) {
|
||||
FrameInstructions.push_back(Inst);
|
||||
return FrameInstructions.size() - 1;
|
||||
}
|
||||
|
||||
/// Return the symbol to be used for the specified basic block when its
|
||||
/// address is taken. This cannot be its normal LBB label because the block
|
||||
/// may be accessed outside its containing function.
|
||||
|
@ -821,8 +821,7 @@ void AsmPrinter::emitCFIInstruction(const MachineInstr &MI) {
|
||||
if (needsCFIMoves() == CFI_M_None)
|
||||
return;
|
||||
|
||||
const MachineModuleInfo &MMI = MF->getMMI();
|
||||
const std::vector<MCCFIInstruction> &Instrs = MMI.getFrameInstructions();
|
||||
const std::vector<MCCFIInstruction> &Instrs = MF->getFrameInstructions();
|
||||
unsigned CFIIndex = MI.getOperand(0).getCFIIndex();
|
||||
const MCCFIInstruction &CFI = Instrs[CFIIndex];
|
||||
emitCFIInstruction(CFI);
|
||||
|
@ -1391,7 +1391,6 @@ bool MIParser::parseCFIRegister(unsigned &Reg) {
|
||||
bool MIParser::parseCFIOperand(MachineOperand &Dest) {
|
||||
auto Kind = Token.kind();
|
||||
lex();
|
||||
auto &MMI = MF.getMMI();
|
||||
int Offset;
|
||||
unsigned Reg;
|
||||
unsigned CFIIndex;
|
||||
@ -1399,27 +1398,26 @@ bool MIParser::parseCFIOperand(MachineOperand &Dest) {
|
||||
case MIToken::kw_cfi_same_value:
|
||||
if (parseCFIRegister(Reg))
|
||||
return true;
|
||||
CFIIndex =
|
||||
MMI.addFrameInst(MCCFIInstruction::createSameValue(nullptr, Reg));
|
||||
CFIIndex = MF.addFrameInst(MCCFIInstruction::createSameValue(nullptr, Reg));
|
||||
break;
|
||||
case MIToken::kw_cfi_offset:
|
||||
if (parseCFIRegister(Reg) || expectAndConsume(MIToken::comma) ||
|
||||
parseCFIOffset(Offset))
|
||||
return true;
|
||||
CFIIndex =
|
||||
MMI.addFrameInst(MCCFIInstruction::createOffset(nullptr, Reg, Offset));
|
||||
MF.addFrameInst(MCCFIInstruction::createOffset(nullptr, Reg, Offset));
|
||||
break;
|
||||
case MIToken::kw_cfi_def_cfa_register:
|
||||
if (parseCFIRegister(Reg))
|
||||
return true;
|
||||
CFIIndex =
|
||||
MMI.addFrameInst(MCCFIInstruction::createDefCfaRegister(nullptr, Reg));
|
||||
MF.addFrameInst(MCCFIInstruction::createDefCfaRegister(nullptr, Reg));
|
||||
break;
|
||||
case MIToken::kw_cfi_def_cfa_offset:
|
||||
if (parseCFIOffset(Offset))
|
||||
return true;
|
||||
// NB: MCCFIInstruction::createDefCfaOffset negates the offset.
|
||||
CFIIndex = MMI.addFrameInst(
|
||||
CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, -Offset));
|
||||
break;
|
||||
case MIToken::kw_cfi_def_cfa:
|
||||
@ -1428,7 +1426,7 @@ bool MIParser::parseCFIOperand(MachineOperand &Dest) {
|
||||
return true;
|
||||
// NB: MCCFIInstruction::createDefCfa negates the offset.
|
||||
CFIIndex =
|
||||
MMI.addFrameInst(MCCFIInstruction::createDefCfa(nullptr, Reg, -Offset));
|
||||
MF.addFrameInst(MCCFIInstruction::createDefCfa(nullptr, Reg, -Offset));
|
||||
break;
|
||||
default:
|
||||
// TODO: Parse the other CFI operands.
|
||||
|
@ -888,8 +888,8 @@ void MIPrinter::print(const MachineOperand &Op, const TargetRegisterInfo *TRI,
|
||||
OS << "<mcsymbol " << *Op.getMCSymbol() << ">";
|
||||
break;
|
||||
case MachineOperand::MO_CFIIndex: {
|
||||
const auto &MMI = Op.getParent()->getParent()->getParent()->getMMI();
|
||||
print(MMI.getFrameInstructions()[Op.getCFIIndex()], TRI);
|
||||
const MachineFunction &MF = *Op.getParent()->getParent()->getParent();
|
||||
print(MF.getFrameInstructions()[Op.getCFIIndex()], TRI);
|
||||
break;
|
||||
}
|
||||
case MachineOperand::MO_IntrinsicID: {
|
||||
|
@ -230,9 +230,6 @@ bool MachineModuleInfo::doFinalization(Module &M) {
|
||||
}
|
||||
|
||||
void MachineModuleInfo::EndFunction() {
|
||||
// Clean up frame info.
|
||||
FrameInstructions.clear();
|
||||
|
||||
// Clean up exception info.
|
||||
LandingPads.clear();
|
||||
PersonalityTypeCache = EHPersonality::Unknown;
|
||||
|
@ -204,9 +204,9 @@ void AArch64FrameLowering::emitCalleeSavedFrameMoves(
|
||||
MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI) const {
|
||||
MachineFunction &MF = *MBB.getParent();
|
||||
MachineFrameInfo &MFI = MF.getFrameInfo();
|
||||
MachineModuleInfo &MMI = MF.getMMI();
|
||||
const MCRegisterInfo *MRI = MMI.getContext().getRegisterInfo();
|
||||
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
|
||||
const TargetSubtargetInfo &STI = MF.getSubtarget();
|
||||
const MCRegisterInfo *MRI = STI.getRegisterInfo();
|
||||
const TargetInstrInfo *TII = STI.getInstrInfo();
|
||||
DebugLoc DL = MBB.findDebugLoc(MBBI);
|
||||
|
||||
// Add callee saved registers to move list.
|
||||
@ -219,7 +219,7 @@ void AArch64FrameLowering::emitCalleeSavedFrameMoves(
|
||||
int64_t Offset =
|
||||
MFI.getObjectOffset(Info.getFrameIdx()) - getOffsetOfLocalArea();
|
||||
unsigned DwarfReg = MRI->getDwarfRegNum(Reg, true);
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, DwarfReg, Offset));
|
||||
BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -446,7 +446,7 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
// Label used to tie together the PROLOG_LABEL and the MachineMoves.
|
||||
MCSymbol *FrameLabel = MMI.getContext().createTempSymbol();
|
||||
// Encode the stack size of the leaf function.
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(FrameLabel, -NumBytes));
|
||||
BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -621,14 +621,14 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
if (HasFP) {
|
||||
// Define the current CFA rule to use the provided FP.
|
||||
unsigned Reg = RegInfo->getDwarfRegNum(FramePtr, true);
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfa(nullptr, Reg, 2 * StackGrowth));
|
||||
BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
.setMIFlags(MachineInstr::FrameSetup);
|
||||
} else {
|
||||
// Encode the stack size of the leaf function.
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, -MFI.getStackSize()));
|
||||
BuildMI(MBB, MBBI, DL, TII->get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
|
@ -201,16 +201,16 @@ struct StackAdjustingInsts {
|
||||
Info->SPAdjust += ExtraBytes;
|
||||
}
|
||||
|
||||
void emitDefCFAOffsets(MachineModuleInfo &MMI, MachineBasicBlock &MBB,
|
||||
const DebugLoc &dl, const ARMBaseInstrInfo &TII,
|
||||
bool HasFP) {
|
||||
void emitDefCFAOffsets(MachineBasicBlock &MBB, const DebugLoc &dl,
|
||||
const ARMBaseInstrInfo &TII, bool HasFP) {
|
||||
MachineFunction &MF = *MBB.getParent();
|
||||
unsigned CFAOffset = 0;
|
||||
for (auto &Info : Insts) {
|
||||
if (HasFP && !Info.BeforeFPSet)
|
||||
return;
|
||||
|
||||
CFAOffset -= Info.SPAdjust;
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, CFAOffset));
|
||||
BuildMI(MBB, std::next(Info.I), dl,
|
||||
TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
@ -338,7 +338,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
DefCFAOffsetCandidates.addInst(std::prev(MBBI),
|
||||
NumBytes - ArgRegsSaveSize, true);
|
||||
}
|
||||
DefCFAOffsetCandidates.emitDefCFAOffsets(MMI, MBB, dl, TII, HasFP);
|
||||
DefCFAOffsetCandidates.emitDefCFAOffsets(MBB, dl, TII, HasFP);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -526,7 +526,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
PushSize + FramePtrOffsetInPush,
|
||||
MachineInstr::FrameSetup);
|
||||
if (FramePtrOffsetInPush + PushSize != 0) {
|
||||
unsigned CFIIndex = MMI.addFrameInst(MCCFIInstruction::createDefCfa(
|
||||
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa(
|
||||
nullptr, MRI->getDwarfRegNum(FramePtr, true),
|
||||
-(ArgRegsSaveSize - FramePtrOffsetInPush)));
|
||||
BuildMI(MBB, AfterPush, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
@ -534,7 +534,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
.setMIFlags(MachineInstr::FrameSetup);
|
||||
} else {
|
||||
unsigned CFIIndex =
|
||||
MMI.addFrameInst(MCCFIInstruction::createDefCfaRegister(
|
||||
MF.addFrameInst(MCCFIInstruction::createDefCfaRegister(
|
||||
nullptr, MRI->getDwarfRegNum(FramePtr, true)));
|
||||
BuildMI(MBB, AfterPush, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -569,7 +569,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
case ARM::R6:
|
||||
case ARM::R7:
|
||||
case ARM::LR:
|
||||
CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, MRI->getDwarfRegNum(Reg, true), MFI.getObjectOffset(FI)));
|
||||
BuildMI(MBB, Pos, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -593,7 +593,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
if (STI.splitFramePushPop(MF)) {
|
||||
unsigned DwarfReg = MRI->getDwarfRegNum(Reg, true);
|
||||
unsigned Offset = MFI.getObjectOffset(FI);
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, DwarfReg, Offset));
|
||||
BuildMI(MBB, Pos, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -615,7 +615,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
(Reg < ARM::D8 || Reg >= ARM::D8 + AFI->getNumAlignedDPRCS2Regs())) {
|
||||
unsigned DwarfReg = MRI->getDwarfRegNum(Reg, true);
|
||||
unsigned Offset = MFI.getObjectOffset(FI);
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, DwarfReg, Offset));
|
||||
BuildMI(MBB, Pos, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -628,7 +628,7 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
// throughout the process. If we have a frame pointer, it takes over the job
|
||||
// half-way through, so only the first few .cfi_def_cfa_offset instructions
|
||||
// actually get emitted.
|
||||
DefCFAOffsetCandidates.emitDefCFAOffsets(MMI, MBB, dl, TII, HasFP);
|
||||
DefCFAOffsetCandidates.emitDefCFAOffsets(MBB, dl, TII, HasFP);
|
||||
|
||||
if (STI.isTargetELF() && hasFP(MF))
|
||||
MFI.setOffsetAdjustment(MFI.getOffsetAdjustment() -
|
||||
@ -2092,14 +2092,14 @@ void ARMFrameLowering::adjustForSegmentedStacks(
|
||||
// Emit the relevant DWARF information about the change in stack pointer as
|
||||
// well as where to find both r4 and r5 (the callee-save registers)
|
||||
CFIIndex =
|
||||
MMI.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, -8));
|
||||
MF.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, -8));
|
||||
BuildMI(PrevStackMBB, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, MRI->getDwarfRegNum(ScratchReg1, true), -4));
|
||||
BuildMI(PrevStackMBB, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, MRI->getDwarfRegNum(ScratchReg0, true), -8));
|
||||
BuildMI(PrevStackMBB, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -2210,10 +2210,10 @@ void ARMFrameLowering::adjustForSegmentedStacks(
|
||||
// Emit the DWARF info about the change in stack as well as where to find the
|
||||
// previous link register
|
||||
CFIIndex =
|
||||
MMI.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, -12));
|
||||
MF.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, -12));
|
||||
BuildMI(AllocMBB, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, MRI->getDwarfRegNum(ARM::LR, true), -12));
|
||||
BuildMI(AllocMBB, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -2265,7 +2265,7 @@ void ARMFrameLowering::adjustForSegmentedStacks(
|
||||
}
|
||||
|
||||
// Update the CFA offset now that we've popped
|
||||
CFIIndex = MMI.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, 0));
|
||||
CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, 0));
|
||||
BuildMI(AllocMBB, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
||||
@ -2288,17 +2288,17 @@ void ARMFrameLowering::adjustForSegmentedStacks(
|
||||
}
|
||||
|
||||
// Update the CFA offset now that we've popped
|
||||
CFIIndex = MMI.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, 0));
|
||||
CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, 0));
|
||||
BuildMI(PostStackMBB, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
||||
// Tell debuggers that r4 and r5 are now the same as they were in the
|
||||
// previous function, that they're the "Same Value".
|
||||
CFIIndex = MMI.addFrameInst(MCCFIInstruction::createSameValue(
|
||||
CFIIndex = MF.addFrameInst(MCCFIInstruction::createSameValue(
|
||||
nullptr, MRI->getDwarfRegNum(ScratchReg0, true)));
|
||||
BuildMI(PostStackMBB, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
CFIIndex = MMI.addFrameInst(MCCFIInstruction::createSameValue(
|
||||
CFIIndex = MF.addFrameInst(MCCFIInstruction::createSameValue(
|
||||
nullptr, MRI->getDwarfRegNum(ScratchReg1, true)));
|
||||
BuildMI(PostStackMBB, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
@ -121,7 +121,7 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
emitSPUpdate(MBB, MBBI, TII, dl, *RegInfo, -ArgRegsSaveSize,
|
||||
MachineInstr::FrameSetup);
|
||||
CFAOffset -= ArgRegsSaveSize;
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, CFAOffset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -133,7 +133,7 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
emitSPUpdate(MBB, MBBI, TII, dl, *RegInfo, -(NumBytes - ArgRegsSaveSize),
|
||||
MachineInstr::FrameSetup);
|
||||
CFAOffset -= NumBytes - ArgRegsSaveSize;
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, CFAOffset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -197,7 +197,7 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
|
||||
if (adjustedGPRCS1Size) {
|
||||
CFAOffset -= adjustedGPRCS1Size;
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, CFAOffset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -225,7 +225,7 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
case ARM::R6:
|
||||
case ARM::R7:
|
||||
case ARM::LR:
|
||||
unsigned CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, MRI->getDwarfRegNum(Reg, true), MFI.getObjectOffset(FI)));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -243,14 +243,14 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
.setMIFlags(MachineInstr::FrameSetup));
|
||||
if(FramePtrOffsetInBlock) {
|
||||
CFAOffset += FramePtrOffsetInBlock;
|
||||
unsigned CFIIndex = MMI.addFrameInst(MCCFIInstruction::createDefCfa(
|
||||
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfa(
|
||||
nullptr, MRI->getDwarfRegNum(FramePtr, true), CFAOffset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
.setMIFlags(MachineInstr::FrameSetup);
|
||||
} else {
|
||||
unsigned CFIIndex =
|
||||
MMI.addFrameInst(MCCFIInstruction::createDefCfaRegister(
|
||||
MF.addFrameInst(MCCFIInstruction::createDefCfaRegister(
|
||||
nullptr, MRI->getDwarfRegNum(FramePtr, true)));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -292,7 +292,7 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
case ARM::R10:
|
||||
case ARM::R11:
|
||||
case ARM::R12: {
|
||||
unsigned CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, MRI->getDwarfRegNum(Reg, true), MFI.getObjectOffset(FI)));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
@ -310,7 +310,7 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
MachineInstr::FrameSetup);
|
||||
if (!HasFP) {
|
||||
CFAOffset -= NumBytes;
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, CFAOffset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex)
|
||||
|
@ -814,15 +814,15 @@ void HexagonFrameLowering::insertCFIInstructionsAt(MachineBasicBlock &MBB,
|
||||
// MCCFIInstruction::createOffset takes the offset without sign change.
|
||||
auto DefCfa = MCCFIInstruction::createDefCfa(FrameLabel, DwFPReg, -8);
|
||||
BuildMI(MBB, At, DL, CFID)
|
||||
.addCFIIndex(MMI.addFrameInst(DefCfa));
|
||||
.addCFIIndex(MF.addFrameInst(DefCfa));
|
||||
// R31 (return addr) = CFA - 4
|
||||
auto OffR31 = MCCFIInstruction::createOffset(FrameLabel, DwRAReg, -4);
|
||||
BuildMI(MBB, At, DL, CFID)
|
||||
.addCFIIndex(MMI.addFrameInst(OffR31));
|
||||
.addCFIIndex(MF.addFrameInst(OffR31));
|
||||
// R30 (frame ptr) = CFA - 8
|
||||
auto OffR30 = MCCFIInstruction::createOffset(FrameLabel, DwFPReg, -8);
|
||||
BuildMI(MBB, At, DL, CFID)
|
||||
.addCFIIndex(MMI.addFrameInst(OffR30));
|
||||
.addCFIIndex(MF.addFrameInst(OffR30));
|
||||
}
|
||||
|
||||
static unsigned int RegsToMove[] = {
|
||||
@ -868,7 +868,7 @@ void HexagonFrameLowering::insertCFIInstructionsAt(MachineBasicBlock &MBB,
|
||||
auto OffReg = MCCFIInstruction::createOffset(FrameLabel, DwarfReg,
|
||||
Offset);
|
||||
BuildMI(MBB, At, DL, CFID)
|
||||
.addCFIIndex(MMI.addFrameInst(OffReg));
|
||||
.addCFIIndex(MF.addFrameInst(OffReg));
|
||||
} else {
|
||||
// Split the double regs into subregs, and generate appropriate
|
||||
// cfi_offsets.
|
||||
@ -883,11 +883,11 @@ void HexagonFrameLowering::insertCFIInstructionsAt(MachineBasicBlock &MBB,
|
||||
auto OffHi = MCCFIInstruction::createOffset(FrameLabel, HiDwarfReg,
|
||||
Offset+4);
|
||||
BuildMI(MBB, At, DL, CFID)
|
||||
.addCFIIndex(MMI.addFrameInst(OffHi));
|
||||
.addCFIIndex(MF.addFrameInst(OffHi));
|
||||
auto OffLo = MCCFIInstruction::createOffset(FrameLabel, LoDwarfReg,
|
||||
Offset);
|
||||
BuildMI(MBB, At, DL, CFID)
|
||||
.addCFIIndex(MMI.addFrameInst(OffLo));
|
||||
.addCFIIndex(MF.addFrameInst(OffLo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ void Mips16FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
TII.makeFrame(Mips::SP, StackSize, MBB, MBBI);
|
||||
|
||||
// emit ".cfi_def_cfa_offset StackSize"
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, -StackSize));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -71,7 +71,7 @@ void Mips16FrameLowering::emitPrologue(MachineFunction &MF,
|
||||
int64_t Offset = MFI.getObjectOffset(I->getFrameIdx());
|
||||
unsigned Reg = I->getReg();
|
||||
unsigned DReg = MRI->getDwarfRegNum(Reg, true);
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, DReg, Offset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
@ -409,7 +409,7 @@ void MipsSEFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
TII.adjustStackPtr(SP, -StackSize, MBB, MBBI);
|
||||
|
||||
// emit ".cfi_def_cfa_offset StackSize"
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, -StackSize));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -443,12 +443,12 @@ void MipsSEFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
if (!STI.isLittle())
|
||||
std::swap(Reg0, Reg1);
|
||||
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, Reg0, Offset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
||||
CFIIndex = MMI.addFrameInst(
|
||||
CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, Reg1, Offset + 4));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -459,18 +459,18 @@ void MipsSEFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
if (!STI.isLittle())
|
||||
std::swap(Reg0, Reg1);
|
||||
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, Reg0, Offset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
||||
CFIIndex = MMI.addFrameInst(
|
||||
CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, Reg1, Offset + 4));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
} else {
|
||||
// Reg is either in GPR32 or FGR32.
|
||||
unsigned CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, MRI->getDwarfRegNum(Reg, 1), Offset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -491,7 +491,7 @@ void MipsSEFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
for (int I = 0; I < 4; ++I) {
|
||||
int64_t Offset = MFI.getObjectOffset(MipsFI->getEhDataRegFI(I));
|
||||
unsigned Reg = MRI->getDwarfRegNum(ABI.GetEhDataReg(I), true);
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, Reg, Offset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -505,7 +505,7 @@ void MipsSEFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
.setMIFlag(MachineInstr::FrameSetup);
|
||||
|
||||
// emit ".cfi_def_cfa_register $fp"
|
||||
unsigned CFIIndex = MMI.addFrameInst(MCCFIInstruction::createDefCfaRegister(
|
||||
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createDefCfaRegister(
|
||||
nullptr, MRI->getDwarfRegNum(FP, true)));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
@ -1105,12 +1105,12 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
// because if the stack needed aligning then CFA won't be at a fixed
|
||||
// offset from FP/SP.
|
||||
unsigned Reg = MRI->getDwarfRegNum(BPReg, true);
|
||||
CFIIndex = MMI.addFrameInst(
|
||||
CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaRegister(nullptr, Reg));
|
||||
} else {
|
||||
// Adjust the definition of CFA to account for the change in SP.
|
||||
assert(NegFrameSize);
|
||||
CFIIndex = MMI.addFrameInst(
|
||||
CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, NegFrameSize));
|
||||
}
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
@ -1119,7 +1119,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
if (HasFP) {
|
||||
// Describe where FP was saved, at a fixed offset from CFA.
|
||||
unsigned Reg = MRI->getDwarfRegNum(FPReg, true);
|
||||
CFIIndex = MMI.addFrameInst(
|
||||
CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, Reg, FPOffset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -1128,7 +1128,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
if (FI->usesPICBase()) {
|
||||
// Describe where FP was saved, at a fixed offset from CFA.
|
||||
unsigned Reg = MRI->getDwarfRegNum(PPC::R30, true);
|
||||
CFIIndex = MMI.addFrameInst(
|
||||
CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, Reg, PBPOffset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -1137,7 +1137,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
if (HasBP) {
|
||||
// Describe where BP was saved, at a fixed offset from CFA.
|
||||
unsigned Reg = MRI->getDwarfRegNum(BPReg, true);
|
||||
CFIIndex = MMI.addFrameInst(
|
||||
CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, Reg, BPOffset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -1146,7 +1146,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
if (MustSaveLR) {
|
||||
// Describe where LR was saved, at a fixed offset from CFA.
|
||||
unsigned Reg = MRI->getDwarfRegNum(LRReg, true);
|
||||
CFIIndex = MMI.addFrameInst(
|
||||
CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, Reg, LROffset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -1163,7 +1163,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
// Change the definition of CFA from SP+offset to FP+offset, because SP
|
||||
// will change at every alloca.
|
||||
unsigned Reg = MRI->getDwarfRegNum(FPReg, true);
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaRegister(nullptr, Reg));
|
||||
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
@ -1197,7 +1197,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
// the whole CR word. In the ELFv2 ABI, every CR that was
|
||||
// actually saved gets its own CFI record.
|
||||
unsigned CRReg = isELFv2ABI? Reg : (unsigned) PPC::CR2;
|
||||
unsigned CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, MRI->getDwarfRegNum(CRReg, true), 8));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -1205,7 +1205,7 @@ void PPCFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
}
|
||||
|
||||
int Offset = MFI.getObjectOffset(CSI[I].getFrameIdx());
|
||||
unsigned CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, MRI->getDwarfRegNum(Reg, true), Offset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
@ -154,24 +154,23 @@ void SparcFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
|
||||
emitSPAdjustment(MF, MBB, MBBI, -NumBytes, SAVErr, SAVEri);
|
||||
|
||||
MachineModuleInfo &MMI = MF.getMMI();
|
||||
unsigned regFP = RegInfo.getDwarfRegNum(SP::I6, true);
|
||||
|
||||
// Emit ".cfi_def_cfa_register 30".
|
||||
unsigned CFIIndex =
|
||||
MMI.addFrameInst(MCCFIInstruction::createDefCfaRegister(nullptr, regFP));
|
||||
MF.addFrameInst(MCCFIInstruction::createDefCfaRegister(nullptr, regFP));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
||||
// Emit ".cfi_window_save".
|
||||
CFIIndex = MMI.addFrameInst(MCCFIInstruction::createWindowSave(nullptr));
|
||||
CFIIndex = MF.addFrameInst(MCCFIInstruction::createWindowSave(nullptr));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
||||
unsigned regInRA = RegInfo.getDwarfRegNum(SP::I7, true);
|
||||
unsigned regOutRA = RegInfo.getDwarfRegNum(SP::O7, true);
|
||||
// Emit ".cfi_register 15, 31".
|
||||
CFIIndex = MMI.addFrameInst(
|
||||
CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createRegister(nullptr, regOutRA, regInRA));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
|
@ -350,7 +350,7 @@ void SystemZFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
unsigned Reg = Save.getReg();
|
||||
if (SystemZ::GR64BitRegClass.contains(Reg)) {
|
||||
int64_t Offset = SPOffsetFromCFA + RegSpillOffsets[Reg];
|
||||
unsigned CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, MRI->getDwarfRegNum(Reg, true), Offset));
|
||||
BuildMI(MBB, MBBI, DL, ZII->get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -374,7 +374,7 @@ void SystemZFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
emitIncrement(MBB, MBBI, DL, SystemZ::R15D, Delta, ZII);
|
||||
|
||||
// Add CFI for the allocation.
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaOffset(nullptr, SPOffsetFromCFA + Delta));
|
||||
BuildMI(MBB, MBBI, DL, ZII->get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -392,7 +392,7 @@ void SystemZFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
|
||||
// Add CFI for the new frame location.
|
||||
unsigned HardFP = MRI->getDwarfRegNum(SystemZ::R11D, true);
|
||||
unsigned CFIIndex = MMI.addFrameInst(
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaRegister(nullptr, HardFP));
|
||||
BuildMI(MBB, MBBI, DL, ZII->get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -422,7 +422,7 @@ void SystemZFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
int64_t Offset =
|
||||
getFrameIndexReference(MF, Save.getFrameIdx(), IgnoredFrameReg);
|
||||
|
||||
unsigned CFIIndex = MMI.addFrameInst(MCCFIInstruction::createOffset(
|
||||
unsigned CFIIndex = MF.addFrameInst(MCCFIInstruction::createOffset(
|
||||
nullptr, DwarfReg, SPOffsetFromCFA + Offset));
|
||||
CFIIndexes.push_back(CFIIndex);
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ void X86FrameLowering::BuildCFI(MachineBasicBlock &MBB,
|
||||
const DebugLoc &DL,
|
||||
const MCCFIInstruction &CFIInst) const {
|
||||
MachineFunction &MF = *MBB.getParent();
|
||||
unsigned CFIIndex = MF.getMMI().addFrameInst(CFIInst);
|
||||
unsigned CFIIndex = MF.addFrameInst(CFIInst);
|
||||
BuildMI(MBB, MBBI, DL, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ static bool CompareSSIOffset(const StackSlotInfo& a, const StackSlotInfo& b) {
|
||||
static void EmitDefCfaRegister(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
const DebugLoc &dl, const TargetInstrInfo &TII,
|
||||
MachineModuleInfo *MMI, unsigned DRegNum) {
|
||||
unsigned CFIIndex = MMI->addFrameInst(
|
||||
MachineFunction &MF, unsigned DRegNum) {
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createDefCfaRegister(nullptr, DRegNum));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -71,18 +71,20 @@ static void EmitDefCfaRegister(MachineBasicBlock &MBB,
|
||||
static void EmitDefCfaOffset(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MBBI,
|
||||
const DebugLoc &dl, const TargetInstrInfo &TII,
|
||||
MachineModuleInfo *MMI, int Offset) {
|
||||
int Offset) {
|
||||
MachineFunction &MF = *MBB.getParent();
|
||||
unsigned CFIIndex =
|
||||
MMI->addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, -Offset));
|
||||
MF.addFrameInst(MCCFIInstruction::createDefCfaOffset(nullptr, -Offset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
}
|
||||
|
||||
static void EmitCfiOffset(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MBBI, const DebugLoc &dl,
|
||||
const TargetInstrInfo &TII, MachineModuleInfo *MMI,
|
||||
unsigned DRegNum, int Offset) {
|
||||
unsigned CFIIndex = MMI->addFrameInst(
|
||||
const TargetInstrInfo &TII, unsigned DRegNum,
|
||||
int Offset) {
|
||||
MachineFunction &MF = *MBB.getParent();
|
||||
unsigned CFIIndex = MF.addFrameInst(
|
||||
MCCFIInstruction::createOffset(nullptr, DRegNum, Offset));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(TargetOpcode::CFI_INSTRUCTION))
|
||||
.addCFIIndex(CFIIndex);
|
||||
@ -96,9 +98,8 @@ static void EmitCfiOffset(MachineBasicBlock &MBB,
|
||||
/// \param [in,out] Adjusted the current SP offset from the top of the frame.
|
||||
static void IfNeededExtSP(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MBBI, const DebugLoc &dl,
|
||||
const TargetInstrInfo &TII, MachineModuleInfo *MMI,
|
||||
int OffsetFromTop, int &Adjusted, int FrameSize,
|
||||
bool emitFrameMoves) {
|
||||
const TargetInstrInfo &TII, int OffsetFromTop,
|
||||
int &Adjusted, int FrameSize, bool emitFrameMoves) {
|
||||
while (OffsetFromTop > Adjusted) {
|
||||
assert(Adjusted < FrameSize && "OffsetFromTop is beyond FrameSize");
|
||||
int remaining = FrameSize - Adjusted;
|
||||
@ -107,7 +108,7 @@ static void IfNeededExtSP(MachineBasicBlock &MBB,
|
||||
BuildMI(MBB, MBBI, dl, TII.get(Opcode)).addImm(OpImm);
|
||||
Adjusted += OpImm;
|
||||
if (emitFrameMoves)
|
||||
EmitDefCfaOffset(MBB, MBBI, dl, TII, MMI, Adjusted*4);
|
||||
EmitDefCfaOffset(MBB, MBBI, dl, TII, Adjusted*4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,9 +267,9 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
MIB->addRegisterKilled(XCore::LR, MF.getSubtarget().getRegisterInfo(),
|
||||
true);
|
||||
if (emitFrameMoves) {
|
||||
EmitDefCfaOffset(MBB, MBBI, dl, TII, MMI, Adjusted*4);
|
||||
EmitDefCfaOffset(MBB, MBBI, dl, TII, Adjusted*4);
|
||||
unsigned DRegNum = MRI->getDwarfRegNum(XCore::LR, true);
|
||||
EmitCfiOffset(MBB, MBBI, dl, TII, MMI, DRegNum, 0);
|
||||
EmitCfiOffset(MBB, MBBI, dl, TII, DRegNum, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -281,7 +282,7 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
assert(SpillList[i].Offset % 4 == 0 && "Misaligned stack offset");
|
||||
assert(SpillList[i].Offset <= 0 && "Unexpected positive stack offset");
|
||||
int OffsetFromTop = - SpillList[i].Offset/4;
|
||||
IfNeededExtSP(MBB, MBBI, dl, TII, MMI, OffsetFromTop, Adjusted, FrameSize,
|
||||
IfNeededExtSP(MBB, MBBI, dl, TII, OffsetFromTop, Adjusted, FrameSize,
|
||||
emitFrameMoves);
|
||||
int Offset = Adjusted - OffsetFromTop;
|
||||
int Opcode = isImmU6(Offset) ? XCore::STWSP_ru6 : XCore::STWSP_lru6;
|
||||
@ -293,12 +294,12 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
MachineMemOperand::MOStore));
|
||||
if (emitFrameMoves) {
|
||||
unsigned DRegNum = MRI->getDwarfRegNum(SpillList[i].Reg, true);
|
||||
EmitCfiOffset(MBB, MBBI, dl, TII, MMI, DRegNum, SpillList[i].Offset);
|
||||
EmitCfiOffset(MBB, MBBI, dl, TII, DRegNum, SpillList[i].Offset);
|
||||
}
|
||||
}
|
||||
|
||||
// Complete any remaining Stack adjustment.
|
||||
IfNeededExtSP(MBB, MBBI, dl, TII, MMI, FrameSize, Adjusted, FrameSize,
|
||||
IfNeededExtSP(MBB, MBBI, dl, TII, FrameSize, Adjusted, FrameSize,
|
||||
emitFrameMoves);
|
||||
assert(Adjusted==FrameSize && "IfNeededExtSP has not completed adjustment");
|
||||
|
||||
@ -306,7 +307,7 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
// Set the FP from the SP.
|
||||
BuildMI(MBB, MBBI, dl, TII.get(XCore::LDAWSP_ru6), FramePtr).addImm(0);
|
||||
if (emitFrameMoves)
|
||||
EmitDefCfaRegister(MBB, MBBI, dl, TII, MMI,
|
||||
EmitDefCfaRegister(MBB, MBBI, dl, TII, MF,
|
||||
MRI->getDwarfRegNum(FramePtr, true));
|
||||
}
|
||||
|
||||
@ -318,7 +319,7 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
const CalleeSavedInfo &CSI = SpillLabel.second;
|
||||
int Offset = MFI.getObjectOffset(CSI.getFrameIdx());
|
||||
unsigned DRegNum = MRI->getDwarfRegNum(CSI.getReg(), true);
|
||||
EmitCfiOffset(MBB, Pos, dl, TII, MMI, DRegNum, Offset);
|
||||
EmitCfiOffset(MBB, Pos, dl, TII, DRegNum, Offset);
|
||||
}
|
||||
if (XFI->hasEHSpillSlot()) {
|
||||
// The unwinder requires stack slot & CFI offsets for the exception info.
|
||||
@ -330,10 +331,10 @@ void XCoreFrameLowering::emitPrologue(MachineFunction &MF,
|
||||
GetEHSpillList(SpillList, MFI, XFI, PersonalityFn,
|
||||
MF.getSubtarget().getTargetLowering());
|
||||
assert(SpillList.size()==2 && "Unexpected SpillList size");
|
||||
EmitCfiOffset(MBB, MBBI, dl, TII, MMI,
|
||||
EmitCfiOffset(MBB, MBBI, dl, TII,
|
||||
MRI->getDwarfRegNum(SpillList[0].Reg, true),
|
||||
SpillList[0].Offset);
|
||||
EmitCfiOffset(MBB, MBBI, dl, TII, MMI,
|
||||
EmitCfiOffset(MBB, MBBI, dl, TII,
|
||||
MRI->getDwarfRegNum(SpillList[1].Reg, true),
|
||||
SpillList[1].Offset);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user