[llvm-commits] [llvm] r65297 - in /llvm/branches/Apple/Dib/lib/Target: ARM/ARMRegisterInfo.cpp Alpha/AlphaRegisterInfo.cpp CellSPU/SPURegisterInfo.cpp IA64/IA64RegisterInfo.cpp Mips/MipsRegisterInfo.cpp Sparc/SparcRegisterInfo.cpp XCore/XCoreRegisterInfo.cpp
Bill Wendling
isanbard at gmail.com
Sun Feb 22 16:40:57 PST 2009
Author: void
Date: Sun Feb 22 18:40:56 2009
New Revision: 65297
URL: http://llvm.org/viewvc/llvm-project?rev=65297&view=rev
Log:
Propagate debug loc info through prologue/epilogue.
Modified:
llvm/branches/Apple/Dib/lib/Target/ARM/ARMRegisterInfo.cpp
llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaRegisterInfo.cpp
llvm/branches/Apple/Dib/lib/Target/CellSPU/SPURegisterInfo.cpp
llvm/branches/Apple/Dib/lib/Target/IA64/IA64RegisterInfo.cpp
llvm/branches/Apple/Dib/lib/Target/Mips/MipsRegisterInfo.cpp
llvm/branches/Apple/Dib/lib/Target/Sparc/SparcRegisterInfo.cpp
llvm/branches/Apple/Dib/lib/Target/XCore/XCoreRegisterInfo.cpp
Modified: llvm/branches/Apple/Dib/lib/Target/ARM/ARMRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/ARM/ARMRegisterInfo.cpp?rev=65297&r1=65296&r2=65297&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/ARM/ARMRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/ARM/ARMRegisterInfo.cpp Sun Feb 22 18:40:56 2009
@@ -1222,7 +1222,8 @@
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 @@
// 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 @@
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);
Modified: llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaRegisterInfo.cpp?rev=65297&r1=65296&r2=65297&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/Alpha/AlphaRegisterInfo.cpp Sun Feb 22 18:40:56 2009
@@ -202,7 +202,8 @@
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 @@
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);
Modified: llvm/branches/Apple/Dib/lib/Target/CellSPU/SPURegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/CellSPU/SPURegisterInfo.cpp?rev=65297&r1=65296&r2=65297&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/CellSPU/SPURegisterInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/CellSPU/SPURegisterInfo.cpp Sun Feb 22 18:40:56 2009
@@ -428,7 +428,8 @@
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 @@
// 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 @@
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");
Modified: llvm/branches/Apple/Dib/lib/Target/IA64/IA64RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/IA64/IA64RegisterInfo.cpp?rev=65297&r1=65296&r2=65297&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/IA64/IA64RegisterInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/IA64/IA64RegisterInfo.cpp Sun Feb 22 18:40:56 2009
@@ -165,7 +165,8 @@
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 @@
}
}
+ 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 @@
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 @@
addReg(IA64::r22);
}
}
-
}
unsigned IA64RegisterInfo::getRARegister() const {
Modified: llvm/branches/Apple/Dib/lib/Target/Mips/MipsRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Mips/MipsRegisterInfo.cpp?rev=65297&r1=65296&r2=65297&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/Mips/MipsRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/Mips/MipsRegisterInfo.cpp Sun Feb 22 18:40:56 2009
@@ -391,7 +391,8 @@
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 @@
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();
Modified: llvm/branches/Apple/Dib/lib/Target/Sparc/SparcRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/Sparc/SparcRegisterInfo.cpp?rev=65297&r1=65296&r2=65297&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/Sparc/SparcRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/Sparc/SparcRegisterInfo.cpp Sun Feb 22 18:40:56 2009
@@ -120,7 +120,9 @@
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 @@
// ----------
// 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::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)
Modified: llvm/branches/Apple/Dib/lib/Target/XCore/XCoreRegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/lib/Target/XCore/XCoreRegisterInfo.cpp?rev=65297&r1=65296&r2=65297&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/lib/Target/XCore/XCoreRegisterInfo.cpp (original)
+++ llvm/branches/Apple/Dib/lib/Target/XCore/XCoreRegisterInfo.cpp Sun Feb 22 18:40:56 2009
@@ -398,7 +398,8 @@
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 @@
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);
More information about the llvm-commits
mailing list