mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-10 22:00:58 +00:00
Propagate debug loc info through prologue/epilogue.
llvm-svn: 65298
This commit is contained in:
parent
3f8637305f
commit
3151437f5c
@ -1222,7 +1222,8 @@ void ARMRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize();
|
||||
unsigned NumBytes = MFI->getStackSize();
|
||||
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = (MBBI != MBB.end() ?
|
||||
MBBI->getDebugLoc() : DebugLoc::getUnknownLoc());
|
||||
|
||||
if (isThumb) {
|
||||
// Check if R3 is live in. It might have to be used as a scratch register.
|
||||
@ -1292,8 +1293,11 @@ void ARMRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
// Build the new SUBri to adjust SP for integer callee-save spill area 1.
|
||||
emitSPUpdate(MBB, MBBI, -GPRCS1Size, ARMCC::AL, 0, isThumb, TII, *this, dl);
|
||||
movePastCSLoadStoreOps(MBB, MBBI, ARM::STR, 1, STI);
|
||||
} else if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tPUSH)
|
||||
} else if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tPUSH) {
|
||||
++MBBI;
|
||||
if (MBBI != MBB.end())
|
||||
dl = MBBI->getDebugLoc();
|
||||
}
|
||||
|
||||
// Darwin ABI requires FP to point to the stack slot that contains the
|
||||
// previous FP.
|
||||
@ -1358,18 +1362,18 @@ static bool isCSRestore(MachineInstr *MI, const unsigned *CSRegs) {
|
||||
|
||||
void ARMRegisterInfo::emitEpilogue(MachineFunction &MF,
|
||||
MachineBasicBlock &MBB) const {
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
MachineBasicBlock::iterator MBBI = prior(MBB.end());
|
||||
assert((MBBI->getOpcode() == ARM::BX_RET ||
|
||||
MBBI->getOpcode() == ARM::tBX_RET ||
|
||||
MBBI->getOpcode() == ARM::tPOP_RET) &&
|
||||
"Can only insert epilog into returning blocks");
|
||||
|
||||
DebugLoc dl = MBBI->getDebugLoc();
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
ARMFunctionInfo *AFI = MF.getInfo<ARMFunctionInfo>();
|
||||
bool isThumb = AFI->isThumbFunction();
|
||||
unsigned VARegSaveSize = AFI->getVarArgsRegSaveSize();
|
||||
int NumBytes = (int)MFI->getStackSize();
|
||||
|
||||
if (!AFI->hasStackFrame()) {
|
||||
if (NumBytes != 0)
|
||||
emitSPUpdate(MBB, MBBI, NumBytes, ARMCC::AL, 0, isThumb, TII, *this, dl);
|
||||
|
@ -202,7 +202,8 @@ void AlphaRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
MachineBasicBlock &MBB = MF.front(); // Prolog goes in entry BB
|
||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = (MBBI != MBB.end() ?
|
||||
MBBI->getDebugLoc() : DebugLoc::getUnknownLoc());
|
||||
bool FP = hasFP(MF);
|
||||
|
||||
static int curgpdist = 0;
|
||||
@ -268,7 +269,7 @@ void AlphaRegisterInfo::emitEpilogue(MachineFunction &MF,
|
||||
assert((MBBI->getOpcode() == Alpha::RETDAG ||
|
||||
MBBI->getOpcode() == Alpha::RETDAGp)
|
||||
&& "Can only insert epilog into returning blocks");
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = MBBI->getDebugLoc();
|
||||
|
||||
bool FP = hasFP(MF);
|
||||
|
||||
|
@ -428,7 +428,8 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const
|
||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = (MBBI != MBB.end() ?
|
||||
MBBI->getDebugLoc() : DebugLoc::getUnknownLoc());
|
||||
|
||||
// Prepare for debug frame info.
|
||||
bool hasDebugInfo = MMI && MMI->hasDebugInfo();
|
||||
@ -521,6 +522,8 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const
|
||||
// this is just a best guess based on the basic block's size.
|
||||
if (MBB.size() >= (unsigned) SPUFrameInfo::branchHintPenalty()) {
|
||||
MachineBasicBlock::iterator MBBI = prior(MBB.end());
|
||||
dl = MBBI->getDebugLoc();
|
||||
|
||||
// Insert terminator label
|
||||
unsigned BranchLabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)).addImm(BranchLabelId);
|
||||
@ -535,7 +538,7 @@ SPURegisterInfo::emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const
|
||||
const MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
int FrameSize = MFI->getStackSize();
|
||||
int LinkSlotOffset = SPUFrameInfo::stackSlotSize();
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = MBBI->getDebugLoc();
|
||||
|
||||
assert(MBBI->getOpcode() == SPU::RET &&
|
||||
"Can only insert epilog into returning blocks");
|
||||
|
@ -165,7 +165,8 @@ void IA64RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
bool FP = hasFP(MF);
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = (MBBI != MBB.end() ?
|
||||
MBBI->getDebugLoc() : DebugLoc::getUnknownLoc());
|
||||
|
||||
// first, we handle the 'alloc' instruction, that should be right up the
|
||||
// top of any function
|
||||
@ -208,6 +209,8 @@ void IA64RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
}
|
||||
}
|
||||
|
||||
if (MBBI != MBB.end()) dl = MBBI->getDebugLoc();
|
||||
|
||||
BuildMI(MBB, MBBI, dl, TII.get(IA64::ALLOC)).
|
||||
addReg(dstRegOfPseudoAlloc).addImm(0).
|
||||
addImm(numStackedGPRsUsed).addImm(numOutRegsUsed).addImm(0);
|
||||
@ -261,24 +264,21 @@ void IA64RegisterInfo::emitEpilogue(MachineFunction &MF,
|
||||
MachineBasicBlock::iterator MBBI = prior(MBB.end());
|
||||
assert(MBBI->getOpcode() == IA64::RET &&
|
||||
"Can only insert epilog into returning blocks");
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
|
||||
DebugLoc dl = MBBI->getDebugLoc();
|
||||
bool FP = hasFP(MF);
|
||||
|
||||
// Get the number of bytes allocated from the FrameInfo...
|
||||
unsigned NumBytes = MFI->getStackSize();
|
||||
|
||||
//now if we need to, restore the old FP
|
||||
if (FP)
|
||||
{
|
||||
if (FP) {
|
||||
//copy the FP into the SP (discards allocas)
|
||||
BuildMI(MBB, MBBI, dl, TII.get(IA64::MOV), IA64::r12).addReg(IA64::r5);
|
||||
//restore the FP
|
||||
BuildMI(MBB, MBBI, dl, TII.get(IA64::LD8), IA64::r5).addReg(IA64::r5);
|
||||
}
|
||||
|
||||
if (NumBytes != 0)
|
||||
{
|
||||
if (NumBytes != 0) {
|
||||
if (NumBytes <= 8191) {
|
||||
BuildMI(MBB, MBBI, dl, TII.get(IA64::ADDIMM22),IA64::r12).
|
||||
addReg(IA64::r12).addImm(NumBytes);
|
||||
@ -289,7 +289,6 @@ void IA64RegisterInfo::emitEpilogue(MachineFunction &MF,
|
||||
addReg(IA64::r22);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
unsigned IA64RegisterInfo::getRARegister() const {
|
||||
|
@ -391,7 +391,8 @@ emitPrologue(MachineFunction &MF) const
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
|
||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = (MBBI != MBB.end() ?
|
||||
MBBI->getDebugLoc() : DebugLoc::getUnknownLoc());
|
||||
bool isPIC = (MF.getTarget().getRelocationModel() == Reloc::PIC_);
|
||||
|
||||
// Get the right frame order for Mips.
|
||||
@ -449,7 +450,7 @@ emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const
|
||||
MachineBasicBlock::iterator MBBI = prior(MBB.end());
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = MBBI->getDebugLoc();
|
||||
|
||||
// Get the number of bytes from FrameInfo
|
||||
int NumBytes = (int) MFI->getStackSize();
|
||||
|
@ -120,7 +120,9 @@ processFunctionBeforeFrameFinalized(MachineFunction &MF) const {}
|
||||
void SparcRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
MachineBasicBlock &MBB = MF.front();
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||
DebugLoc dl = (MBBI != MBB.end() ?
|
||||
MBBI->getDebugLoc() : DebugLoc::getUnknownLoc());
|
||||
|
||||
// Get the number of bytes to allocate from the FrameInfo
|
||||
int NumBytes = (int) MFI->getStackSize();
|
||||
@ -133,24 +135,24 @@ void SparcRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
// ----------
|
||||
// 23 words * 4 bytes per word = 92 bytes
|
||||
NumBytes += 92;
|
||||
|
||||
// Round up to next doubleword boundary -- a double-word boundary
|
||||
// is required by the ABI.
|
||||
NumBytes = (NumBytes + 7) & ~7;
|
||||
NumBytes = -NumBytes;
|
||||
|
||||
if (NumBytes >= -4096) {
|
||||
BuildMI(MBB, MBB.begin(), dl, TII.get(SP::SAVEri),
|
||||
SP::O6).addReg(SP::O6).addImm(NumBytes);
|
||||
BuildMI(MBB, MBBI, dl, TII.get(SP::SAVEri), SP::O6)
|
||||
.addReg(SP::O6).addImm(NumBytes);
|
||||
} else {
|
||||
MachineBasicBlock::iterator InsertPt = MBB.begin();
|
||||
// Emit this the hard way. This clobbers G1 which we always know is
|
||||
// available here.
|
||||
unsigned OffHi = (unsigned)NumBytes >> 10U;
|
||||
BuildMI(MBB, InsertPt, dl, TII.get(SP::SETHIi), SP::G1).addImm(OffHi);
|
||||
BuildMI(MBB, MBBI, dl, TII.get(SP::SETHIi), SP::G1).addImm(OffHi);
|
||||
// Emit G1 = G1 + I6
|
||||
BuildMI(MBB, InsertPt, dl, TII.get(SP::ORri), SP::G1)
|
||||
BuildMI(MBB, MBBI, dl, TII.get(SP::ORri), SP::G1)
|
||||
.addReg(SP::G1).addImm(NumBytes & ((1 << 10)-1));
|
||||
BuildMI(MBB, InsertPt, dl, TII.get(SP::SAVErr), SP::O6)
|
||||
BuildMI(MBB, MBBI, dl, TII.get(SP::SAVErr), SP::O6)
|
||||
.addReg(SP::O6).addReg(SP::G1);
|
||||
}
|
||||
}
|
||||
@ -158,7 +160,7 @@ void SparcRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
void SparcRegisterInfo::emitEpilogue(MachineFunction &MF,
|
||||
MachineBasicBlock &MBB) const {
|
||||
MachineBasicBlock::iterator MBBI = prior(MBB.end());
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = MBBI->getDebugLoc();
|
||||
assert(MBBI->getOpcode() == SP::RETL &&
|
||||
"Can only put epilog before 'retl' instruction!");
|
||||
BuildMI(MBB, MBBI, dl, TII.get(SP::RESTORErr), SP::G0).addReg(SP::G0)
|
||||
|
@ -398,7 +398,8 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
|
||||
XCoreFunctionInfo *XFI = MF.getInfo<XCoreFunctionInfo>();
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = (MBBI != MBB.end() ?
|
||||
MBBI->getDebugLoc() : DebugLoc::getUnknownLoc());
|
||||
|
||||
bool FP = hasFP(MF);
|
||||
|
||||
@ -515,7 +516,7 @@ void XCoreRegisterInfo::emitEpilogue(MachineFunction &MF,
|
||||
MachineBasicBlock &MBB) const {
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
MachineBasicBlock::iterator MBBI = prior(MBB.end());
|
||||
DebugLoc dl = DebugLoc::getUnknownLoc();
|
||||
DebugLoc dl = MBBI->getDebugLoc();
|
||||
|
||||
bool FP = hasFP(MF);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user