forked from OSchip/llvm-project
[DebugInfo] Fix ARM/AArch64 prologue_end position. Related to D11268.
Summary: This review is related to another review request http://reviews.llvm.org/D11268, does the same and merely fixes a couple of issues with it. D11268 is quite old and has merge conflicts against the current trunk. This request - rebases D11268 onto the new trunk; - resolves the merge conflicts; - fixes the prologue_end tests, which do not pass due to the subprogram definitions not marked as distinct. Reviewers: echristo, rengolin, kubabrecka Subscribers: aemerson, rengolin, jyknight, dsanders, llvm-commits, asl Differential Revision: http://reviews.llvm.org/D14338 llvm-svn: 252177
This commit is contained in:
parent
99fba3c141
commit
057c5a6b2b
|
@ -284,13 +284,16 @@ void AArch64FrameLowering::emitPrologue(MachineFunction &MF,
|
||||||
MF.getSubtarget().getRegisterInfo());
|
MF.getSubtarget().getRegisterInfo());
|
||||||
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
|
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
|
||||||
MachineModuleInfo &MMI = MF.getMMI();
|
MachineModuleInfo &MMI = MF.getMMI();
|
||||||
AArch64FunctionInfo *AFI = MF.getInfo<AArch64FunctionInfo>();
|
AArch64FunctionInfo *AFI = MF.getInfo<AArch64FunctionInfo>();
|
||||||
bool needsFrameMoves = MMI.hasDebugInfo() || Fn->needsUnwindTableEntry();
|
bool needsFrameMoves = MMI.hasDebugInfo() || Fn->needsUnwindTableEntry();
|
||||||
bool HasFP = hasFP(MF);
|
bool HasFP = hasFP(MF);
|
||||||
DebugLoc DL = MBB.findDebugLoc(MBBI);
|
|
||||||
|
// Debug location must be unknown since the first debug location is used
|
||||||
// All calls are tail calls in GHC calling conv, and functions have no
|
// to determine the end of the prologue.
|
||||||
// prologue/epilogue.
|
DebugLoc DL;
|
||||||
|
|
||||||
|
// All calls are tail calls in GHC calling conv, and functions have no
|
||||||
|
// prologue/epilogue.
|
||||||
if (MF.getFunction()->getCallingConv() == CallingConv::GHC)
|
if (MF.getFunction()->getCallingConv() == CallingConv::GHC)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -727,15 +730,12 @@ bool AArch64FrameLowering::spillCalleeSavedRegisters(
|
||||||
MachineFunction &MF = *MBB.getParent();
|
MachineFunction &MF = *MBB.getParent();
|
||||||
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
|
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
|
||||||
unsigned Count = CSI.size();
|
unsigned Count = CSI.size();
|
||||||
DebugLoc DL;
|
DebugLoc DL;
|
||||||
assert((Count & 1) == 0 && "Odd number of callee-saved regs to spill!");
|
assert((Count & 1) == 0 && "Odd number of callee-saved regs to spill!");
|
||||||
|
|
||||||
if (MI != MBB.end())
|
for (unsigned i = 0; i < Count; i += 2) {
|
||||||
DL = MI->getDebugLoc();
|
unsigned idx = Count - i - 2;
|
||||||
|
unsigned Reg1 = CSI[idx].getReg();
|
||||||
for (unsigned i = 0; i < Count; i += 2) {
|
|
||||||
unsigned idx = Count - i - 2;
|
|
||||||
unsigned Reg1 = CSI[idx].getReg();
|
|
||||||
unsigned Reg2 = CSI[idx + 1].getReg();
|
unsigned Reg2 = CSI[idx + 1].getReg();
|
||||||
// GPRs and FPRs are saved in pairs of 64-bit regs. We expect the CSI
|
// GPRs and FPRs are saved in pairs of 64-bit regs. We expect the CSI
|
||||||
// list to come in sorted by frame index so that we can issue the store
|
// list to come in sorted by frame index so that we can issue the store
|
||||||
|
|
|
@ -302,13 +302,17 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF,
|
||||||
"This emitPrologue does not support Thumb1!");
|
"This emitPrologue does not support Thumb1!");
|
||||||
bool isARM = !AFI->isThumbFunction();
|
bool isARM = !AFI->isThumbFunction();
|
||||||
unsigned Align = STI.getFrameLowering()->getStackAlignment();
|
unsigned Align = STI.getFrameLowering()->getStackAlignment();
|
||||||
unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize();
|
unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize();
|
||||||
unsigned NumBytes = MFI->getStackSize();
|
unsigned NumBytes = MFI->getStackSize();
|
||||||
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
|
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
|
||||||
DebugLoc dl = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
|
|
||||||
unsigned FramePtr = RegInfo->getFrameRegister(MF);
|
// Debug location must be unknown since the first debug location is used
|
||||||
|
// to determine the end of the prologue.
|
||||||
// Determine the sizes of each callee-save spill areas and record which frame
|
DebugLoc dl;
|
||||||
|
|
||||||
|
unsigned FramePtr = RegInfo->getFrameRegister(MF);
|
||||||
|
|
||||||
|
// Determine the sizes of each callee-save spill areas and record which frame
|
||||||
// belongs to which callee-save spill areas.
|
// belongs to which callee-save spill areas.
|
||||||
unsigned GPRCS1Size = 0, GPRCS2Size = 0, DPRCSSize = 0;
|
unsigned GPRCS1Size = 0, GPRCS2Size = 0, DPRCSSize = 0;
|
||||||
int FramePtrSpillFI = 0;
|
int FramePtrSpillFI = 0;
|
||||||
|
@ -890,13 +894,12 @@ void ARMFrameLowering::emitPushInst(MachineBasicBlock &MBB,
|
||||||
unsigned NumAlignedDPRCS2Regs,
|
unsigned NumAlignedDPRCS2Regs,
|
||||||
unsigned MIFlags) const {
|
unsigned MIFlags) const {
|
||||||
MachineFunction &MF = *MBB.getParent();
|
MachineFunction &MF = *MBB.getParent();
|
||||||
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
|
const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
|
||||||
|
|
||||||
DebugLoc DL;
|
DebugLoc DL;
|
||||||
if (MI != MBB.end()) DL = MI->getDebugLoc();
|
|
||||||
|
SmallVector<std::pair<unsigned,bool>, 4> Regs;
|
||||||
SmallVector<std::pair<unsigned,bool>, 4> Regs;
|
unsigned i = CSI.size();
|
||||||
unsigned i = CSI.size();
|
|
||||||
while (i != 0) {
|
while (i != 0) {
|
||||||
unsigned LastReg = 0;
|
unsigned LastReg = 0;
|
||||||
for (; i != 0; --i) {
|
for (; i != 0; --i) {
|
||||||
|
|
|
@ -97,13 +97,17 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF,
|
||||||
|
|
||||||
unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize();
|
unsigned ArgRegsSaveSize = AFI->getArgRegsSaveSize();
|
||||||
unsigned NumBytes = MFI->getStackSize();
|
unsigned NumBytes = MFI->getStackSize();
|
||||||
assert(NumBytes >= ArgRegsSaveSize &&
|
assert(NumBytes >= ArgRegsSaveSize &&
|
||||||
"ArgRegsSaveSize is included in NumBytes");
|
"ArgRegsSaveSize is included in NumBytes");
|
||||||
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
|
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
|
||||||
DebugLoc dl = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
|
|
||||||
unsigned FramePtr = RegInfo->getFrameRegister(MF);
|
// Debug location must be unknown since the first debug location is used
|
||||||
unsigned BasePtr = RegInfo->getBaseRegister();
|
// to determine the end of the prologue.
|
||||||
int CFAOffset = 0;
|
DebugLoc dl;
|
||||||
|
|
||||||
|
unsigned FramePtr = RegInfo->getFrameRegister(MF);
|
||||||
|
unsigned BasePtr = RegInfo->getBaseRegister();
|
||||||
|
int CFAOffset = 0;
|
||||||
|
|
||||||
// Thumb add/sub sp, imm8 instructions implicitly multiply the offset by 4.
|
// Thumb add/sub sp, imm8 instructions implicitly multiply the offset by 4.
|
||||||
NumBytes = (NumBytes + 3) & ~3;
|
NumBytes = (NumBytes + 3) & ~3;
|
||||||
|
@ -165,14 +169,12 @@ void Thumb1FrameLowering::emitPrologue(MachineFunction &MF,
|
||||||
DPRCSSize += 8;
|
DPRCSSize += 8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tPUSH) {
|
if (MBBI != MBB.end() && MBBI->getOpcode() == ARM::tPUSH) {
|
||||||
++MBBI;
|
++MBBI;
|
||||||
if (MBBI != MBB.end())
|
}
|
||||||
dl = MBBI->getDebugLoc();
|
|
||||||
}
|
// Determine starting offsets of spill areas.
|
||||||
|
|
||||||
// Determine starting offsets of spill areas.
|
|
||||||
unsigned DPRCSOffset = NumBytes - ArgRegsSaveSize - (GPRCS1Size + GPRCS2Size + DPRCSSize);
|
unsigned DPRCSOffset = NumBytes - ArgRegsSaveSize - (GPRCS1Size + GPRCS2Size + DPRCSSize);
|
||||||
unsigned GPRCS2Offset = DPRCSOffset + DPRCSSize;
|
unsigned GPRCS2Offset = DPRCSOffset + DPRCSSize;
|
||||||
unsigned GPRCS1Offset = GPRCS2Offset + GPRCS2Size;
|
unsigned GPRCS1Offset = GPRCS2Offset + GPRCS2Size;
|
||||||
|
@ -543,14 +545,12 @@ spillCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||||
if (CSI.empty())
|
if (CSI.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DebugLoc DL;
|
DebugLoc DL;
|
||||||
const TargetInstrInfo &TII = *STI.getInstrInfo();
|
const TargetInstrInfo &TII = *STI.getInstrInfo();
|
||||||
|
|
||||||
if (MI != MBB.end()) DL = MI->getDebugLoc();
|
MachineInstrBuilder MIB = BuildMI(MBB, MI, DL, TII.get(ARM::tPUSH));
|
||||||
|
AddDefaultPred(MIB);
|
||||||
MachineInstrBuilder MIB = BuildMI(MBB, MI, DL, TII.get(ARM::tPUSH));
|
for (unsigned i = CSI.size(); i != 0; --i) {
|
||||||
AddDefaultPred(MIB);
|
|
||||||
for (unsigned i = CSI.size(); i != 0; --i) {
|
|
||||||
unsigned Reg = CSI[i-1].getReg();
|
unsigned Reg = CSI[i-1].getReg();
|
||||||
bool isKill = true;
|
bool isKill = true;
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,17 @@ void Mips16FrameLowering::emitPrologue(MachineFunction &MF,
|
||||||
MachineBasicBlock &MBB) const {
|
MachineBasicBlock &MBB) const {
|
||||||
assert(&MF.front() == &MBB && "Shrink-wrapping not yet supported");
|
assert(&MF.front() == &MBB && "Shrink-wrapping not yet supported");
|
||||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||||
const Mips16InstrInfo &TII =
|
const Mips16InstrInfo &TII =
|
||||||
*static_cast<const Mips16InstrInfo *>(STI.getInstrInfo());
|
*static_cast<const Mips16InstrInfo *>(STI.getInstrInfo());
|
||||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||||
DebugLoc dl = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
|
|
||||||
uint64_t StackSize = MFI->getStackSize();
|
// Debug location must be unknown since the first debug location is used
|
||||||
|
// to determine the end of the prologue.
|
||||||
// No need to allocate space on the stack.
|
DebugLoc dl;
|
||||||
|
|
||||||
|
uint64_t StackSize = MFI->getStackSize();
|
||||||
|
|
||||||
|
// No need to allocate space on the stack.
|
||||||
if (StackSize == 0 && !MFI->adjustsStack()) return;
|
if (StackSize == 0 && !MFI->adjustsStack()) return;
|
||||||
|
|
||||||
MachineModuleInfo &MMI = MF.getMMI();
|
MachineModuleInfo &MMI = MF.getMMI();
|
||||||
|
|
|
@ -70,13 +70,13 @@ void Mips16DAGToDAGISel::initGlobalBaseReg(MachineFunction &MF) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MachineBasicBlock &MBB = MF.front();
|
MachineBasicBlock &MBB = MF.front();
|
||||||
MachineBasicBlock::iterator I = MBB.begin();
|
MachineBasicBlock::iterator I = MBB.begin();
|
||||||
MachineRegisterInfo &RegInfo = MF.getRegInfo();
|
MachineRegisterInfo &RegInfo = MF.getRegInfo();
|
||||||
const TargetInstrInfo &TII = *Subtarget->getInstrInfo();
|
const TargetInstrInfo &TII = *Subtarget->getInstrInfo();
|
||||||
DebugLoc DL = I != MBB.end() ? I->getDebugLoc() : DebugLoc();
|
DebugLoc DL;
|
||||||
unsigned V0, V1, V2, GlobalBaseReg = MipsFI->getGlobalBaseReg();
|
unsigned V0, V1, V2, GlobalBaseReg = MipsFI->getGlobalBaseReg();
|
||||||
const TargetRegisterClass *RC = &Mips::CPU16RegsRegClass;
|
const TargetRegisterClass *RC = &Mips::CPU16RegsRegClass;
|
||||||
|
|
||||||
V0 = RegInfo.createVirtualRegister(RC);
|
V0 = RegInfo.createVirtualRegister(RC);
|
||||||
V1 = RegInfo.createVirtualRegister(RC);
|
V1 = RegInfo.createVirtualRegister(RC);
|
||||||
V2 = RegInfo.createVirtualRegister(RC);
|
V2 = RegInfo.createVirtualRegister(RC);
|
||||||
|
|
|
@ -193,13 +193,13 @@ static void addSaveRestoreRegs(MachineInstrBuilder &MIB,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Adjust SP by FrameSize bytes. Save RA, S0, S1
|
// Adjust SP by FrameSize bytes. Save RA, S0, S1
|
||||||
void Mips16InstrInfo::makeFrame(unsigned SP, int64_t FrameSize,
|
void Mips16InstrInfo::makeFrame(unsigned SP, int64_t FrameSize,
|
||||||
MachineBasicBlock &MBB,
|
MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator I) const {
|
MachineBasicBlock::iterator I) const {
|
||||||
DebugLoc DL = I != MBB.end() ? I->getDebugLoc() : DebugLoc();
|
DebugLoc DL;
|
||||||
MachineFunction &MF = *MBB.getParent();
|
MachineFunction &MF = *MBB.getParent();
|
||||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||||
const BitVector Reserved = RI.getReservedRegs(MF);
|
const BitVector Reserved = RI.getReservedRegs(MF);
|
||||||
bool SaveS2 = Reserved[Mips::S2];
|
bool SaveS2 = Reserved[Mips::S2];
|
||||||
MachineInstrBuilder MIB;
|
MachineInstrBuilder MIB;
|
||||||
unsigned Opc = ((FrameSize <= 128) && !SaveS2)? Mips::Save16:Mips::SaveX16;
|
unsigned Opc = ((FrameSize <= 128) && !SaveS2)? Mips::Save16:Mips::SaveX16;
|
||||||
|
@ -260,13 +260,13 @@ void Mips16InstrInfo::restoreFrame(unsigned SP, int64_t FrameSize,
|
||||||
// This is clearly safe at prologue and epilogue.
|
// This is clearly safe at prologue and epilogue.
|
||||||
//
|
//
|
||||||
void Mips16InstrInfo::adjustStackPtrBig(unsigned SP, int64_t Amount,
|
void Mips16InstrInfo::adjustStackPtrBig(unsigned SP, int64_t Amount,
|
||||||
MachineBasicBlock &MBB,
|
MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator I,
|
MachineBasicBlock::iterator I,
|
||||||
unsigned Reg1, unsigned Reg2) const {
|
unsigned Reg1, unsigned Reg2) const {
|
||||||
DebugLoc DL = I != MBB.end() ? I->getDebugLoc() : DebugLoc();
|
DebugLoc DL;
|
||||||
//
|
//
|
||||||
// li reg1, constant
|
// li reg1, constant
|
||||||
// move reg2, sp
|
// move reg2, sp
|
||||||
// add reg1, reg1, reg2
|
// add reg1, reg1, reg2
|
||||||
// move sp, reg1
|
// move sp, reg1
|
||||||
//
|
//
|
||||||
|
@ -443,13 +443,13 @@ const MCInstrDesc &Mips16InstrInfo::AddiuSpImm(int64_t Imm) const {
|
||||||
else
|
else
|
||||||
return get(Mips::AddiuSpImmX16);
|
return get(Mips::AddiuSpImmX16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mips16InstrInfo::BuildAddiuSpImm
|
void Mips16InstrInfo::BuildAddiuSpImm
|
||||||
(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, int64_t Imm) const {
|
(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, int64_t Imm) const {
|
||||||
DebugLoc DL = I != MBB.end() ? I->getDebugLoc() : DebugLoc();
|
DebugLoc DL;
|
||||||
BuildMI(MBB, I, DL, AddiuSpImm(Imm)).addImm(Imm);
|
BuildMI(MBB, I, DL, AddiuSpImm(Imm)).addImm(Imm);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MipsInstrInfo *llvm::createMips16InstrInfo(const MipsSubtarget &STI) {
|
const MipsInstrInfo *llvm::createMips16InstrInfo(const MipsSubtarget &STI) {
|
||||||
return new Mips16InstrInfo(STI);
|
return new Mips16InstrInfo(STI);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,13 +41,13 @@ void SparcFrameLowering::emitSPAdjustment(MachineFunction &MF,
|
||||||
MachineBasicBlock &MBB,
|
MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator MBBI,
|
MachineBasicBlock::iterator MBBI,
|
||||||
int NumBytes,
|
int NumBytes,
|
||||||
unsigned ADDrr,
|
unsigned ADDrr,
|
||||||
unsigned ADDri) const {
|
unsigned ADDri) const {
|
||||||
|
|
||||||
DebugLoc dl = (MBBI != MBB.end()) ? MBBI->getDebugLoc() : DebugLoc();
|
DebugLoc dl;
|
||||||
const SparcInstrInfo &TII =
|
const SparcInstrInfo &TII =
|
||||||
*static_cast<const SparcInstrInfo *>(MF.getSubtarget().getInstrInfo());
|
*static_cast<const SparcInstrInfo *>(MF.getSubtarget().getInstrInfo());
|
||||||
|
|
||||||
if (NumBytes >= -4096 && NumBytes < 4096) {
|
if (NumBytes >= -4096 && NumBytes < 4096) {
|
||||||
BuildMI(MBB, MBBI, dl, TII.get(ADDri), SP::O6)
|
BuildMI(MBB, MBBI, dl, TII.get(ADDri), SP::O6)
|
||||||
.addReg(SP::O6).addImm(NumBytes);
|
.addReg(SP::O6).addImm(NumBytes);
|
||||||
|
@ -93,7 +93,9 @@ void SparcFrameLowering::emitPrologue(MachineFunction &MF,
|
||||||
const SparcRegisterInfo &RegInfo =
|
const SparcRegisterInfo &RegInfo =
|
||||||
*static_cast<const SparcRegisterInfo *>(MF.getSubtarget().getRegisterInfo());
|
*static_cast<const SparcRegisterInfo *>(MF.getSubtarget().getRegisterInfo());
|
||||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||||
DebugLoc dl = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
|
// Debug location must be unknown since the first debug location is used
|
||||||
|
// to determine the end of the prologue.
|
||||||
|
DebugLoc dl;
|
||||||
bool NeedsStackRealignment = RegInfo.needsStackRealignment(MF);
|
bool NeedsStackRealignment = RegInfo.needsStackRealignment(MF);
|
||||||
|
|
||||||
// FIXME: unfortunately, returning false from canRealignStack
|
// FIXME: unfortunately, returning false from canRealignStack
|
||||||
|
|
|
@ -130,13 +130,13 @@ spillCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
MachineFunction &MF = *MBB.getParent();
|
MachineFunction &MF = *MBB.getParent();
|
||||||
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
|
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
|
||||||
SystemZMachineFunctionInfo *ZFI = MF.getInfo<SystemZMachineFunctionInfo>();
|
SystemZMachineFunctionInfo *ZFI = MF.getInfo<SystemZMachineFunctionInfo>();
|
||||||
bool IsVarArg = MF.getFunction()->isVarArg();
|
bool IsVarArg = MF.getFunction()->isVarArg();
|
||||||
DebugLoc DL = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
|
DebugLoc DL;
|
||||||
|
|
||||||
// Scan the call-saved GPRs and find the bounds of the register spill area.
|
// Scan the call-saved GPRs and find the bounds of the register spill area.
|
||||||
unsigned LowGPR = 0;
|
unsigned LowGPR = 0;
|
||||||
unsigned HighGPR = SystemZ::R15D;
|
unsigned HighGPR = SystemZ::R15D;
|
||||||
unsigned StartOffset = -1U;
|
unsigned StartOffset = -1U;
|
||||||
for (unsigned I = 0, E = CSI.size(); I != E; ++I) {
|
for (unsigned I = 0, E = CSI.size(); I != E; ++I) {
|
||||||
|
@ -319,13 +319,16 @@ void SystemZFrameLowering::emitPrologue(MachineFunction &MF,
|
||||||
SystemZMachineFunctionInfo *ZFI = MF.getInfo<SystemZMachineFunctionInfo>();
|
SystemZMachineFunctionInfo *ZFI = MF.getInfo<SystemZMachineFunctionInfo>();
|
||||||
MachineBasicBlock::iterator MBBI = MBB.begin();
|
MachineBasicBlock::iterator MBBI = MBB.begin();
|
||||||
MachineModuleInfo &MMI = MF.getMMI();
|
MachineModuleInfo &MMI = MF.getMMI();
|
||||||
const MCRegisterInfo *MRI = MMI.getContext().getRegisterInfo();
|
const MCRegisterInfo *MRI = MMI.getContext().getRegisterInfo();
|
||||||
const std::vector<CalleeSavedInfo> &CSI = MFFrame->getCalleeSavedInfo();
|
const std::vector<CalleeSavedInfo> &CSI = MFFrame->getCalleeSavedInfo();
|
||||||
bool HasFP = hasFP(MF);
|
bool HasFP = hasFP(MF);
|
||||||
DebugLoc DL = MBBI != MBB.end() ? MBBI->getDebugLoc() : DebugLoc();
|
|
||||||
|
// Debug location must be unknown since the first debug location is used
|
||||||
// The current offset of the stack pointer from the CFA.
|
// to determine the end of the prologue.
|
||||||
int64_t SPOffsetFromCFA = -SystemZMC::CFAOffsetFromInitialSP;
|
DebugLoc DL;
|
||||||
|
|
||||||
|
// The current offset of the stack pointer from the CFA.
|
||||||
|
int64_t SPOffsetFromCFA = -SystemZMC::CFAOffsetFromInitialSP;
|
||||||
|
|
||||||
if (ZFI->getLowSavedGPR()) {
|
if (ZFI->getLowSavedGPR()) {
|
||||||
// Skip over the GPR saves.
|
// Skip over the GPR saves.
|
||||||
|
|
|
@ -637,12 +637,15 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF,
|
||||||
unsigned FramePtr = TRI->getFrameRegister(MF);
|
unsigned FramePtr = TRI->getFrameRegister(MF);
|
||||||
const unsigned MachineFramePtr =
|
const unsigned MachineFramePtr =
|
||||||
STI.isTarget64BitILP32()
|
STI.isTarget64BitILP32()
|
||||||
? getX86SubSuperRegister(FramePtr, MVT::i64, false)
|
? getX86SubSuperRegister(FramePtr, MVT::i64, false)
|
||||||
: FramePtr;
|
: FramePtr;
|
||||||
unsigned BasePtr = TRI->getBaseRegister();
|
unsigned BasePtr = TRI->getBaseRegister();
|
||||||
DebugLoc DL;
|
|
||||||
|
// Debug location must be unknown since the first debug location is used
|
||||||
// Add RETADDR move area to callee saved frame size.
|
// to determine the end of the prologue.
|
||||||
|
DebugLoc DL;
|
||||||
|
|
||||||
|
// Add RETADDR move area to callee saved frame size.
|
||||||
int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta();
|
int TailCallReturnAddrDelta = X86FI->getTCReturnAddrDelta();
|
||||||
if (TailCallReturnAddrDelta && IsWin64Prologue)
|
if (TailCallReturnAddrDelta && IsWin64Prologue)
|
||||||
report_fatal_error("Can't handle guaranteed tail call under win64 yet");
|
report_fatal_error("Can't handle guaranteed tail call under win64 yet");
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
; RUN: llc -disable-fp-elim -O0 %s -mtriple aarch64-apple-darwin -o - | FileCheck %s
|
||||||
|
|
||||||
|
; int func(void);
|
||||||
|
; void prologue_end_test() {
|
||||||
|
; func();
|
||||||
|
; func();
|
||||||
|
; }
|
||||||
|
|
||||||
|
define void @prologue_end_test() nounwind uwtable {
|
||||||
|
; CHECK: prologue_end_test:
|
||||||
|
; CHECK: .cfi_startproc
|
||||||
|
; CHECK: stp x29, x30
|
||||||
|
; CHECK: mov x29, sp
|
||||||
|
; CHECK: sub sp, sp
|
||||||
|
; CHECK: .loc 1 3 3 prologue_end
|
||||||
|
; CHECK: bl _func
|
||||||
|
; CHECK: bl _func
|
||||||
|
entry:
|
||||||
|
%call = call i32 @func(), !dbg !11
|
||||||
|
%call1 = call i32 @func(), !dbg !12
|
||||||
|
ret void, !dbg !13
|
||||||
|
}
|
||||||
|
|
||||||
|
declare i32 @func()
|
||||||
|
|
||||||
|
!llvm.dbg.cu = !{!0}
|
||||||
|
!llvm.module.flags = !{!7, !8, !9}
|
||||||
|
!llvm.ident = !{!10}
|
||||||
|
|
||||||
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 242129)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
|
||||||
|
!1 = !DIFile(filename: "foo.c", directory: "/tmp")
|
||||||
|
!2 = !{}
|
||||||
|
!3 = !{!4}
|
||||||
|
!4 = distinct !DISubprogram(name: "prologue_end_test", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, function: void ()* @prologue_end_test, variables: !2)
|
||||||
|
!5 = !DISubroutineType(types: !6)
|
||||||
|
!6 = !{null}
|
||||||
|
!7 = !{i32 2, !"Dwarf Version", i32 2}
|
||||||
|
!8 = !{i32 2, !"Debug Info Version", i32 3}
|
||||||
|
!9 = !{i32 1, !"PIC Level", i32 2}
|
||||||
|
!10 = !{!"clang version 3.7.0 (trunk 242129)"}
|
||||||
|
!11 = !DILocation(line: 3, column: 3, scope: !4)
|
||||||
|
!12 = !DILocation(line: 4, column: 3, scope: !4)
|
||||||
|
!13 = !DILocation(line: 5, column: 1, scope: !4)
|
|
@ -0,0 +1,46 @@
|
||||||
|
; RUN: llc -disable-fp-elim -O0 %s -mtriple armv7-apple-darwin -o - | FileCheck %s
|
||||||
|
; RUN: llc -disable-fp-elim -O0 %s -mtriple thumbv1-apple-darwin -o - | FileCheck %s
|
||||||
|
|
||||||
|
; int func(void);
|
||||||
|
; void prologue_end_test() {
|
||||||
|
; func();
|
||||||
|
; func();
|
||||||
|
; }
|
||||||
|
|
||||||
|
define void @prologue_end_test() nounwind uwtable {
|
||||||
|
; CHECK: prologue_end_test:
|
||||||
|
; CHECK: .cfi_startproc
|
||||||
|
; CHECK: push {r7, lr}
|
||||||
|
; CHECK: {{mov r7, sp|add r7, sp}}
|
||||||
|
; CHECK: sub sp
|
||||||
|
; CHECK: .loc 1 3 3 prologue_end
|
||||||
|
; CHECK: bl {{_func|Ltmp}}
|
||||||
|
; CHECK: bl {{_func|Ltmp}}
|
||||||
|
entry:
|
||||||
|
%call = call i32 @func(), !dbg !13
|
||||||
|
%call1 = call i32 @func(), !dbg !14
|
||||||
|
ret void, !dbg !15
|
||||||
|
}
|
||||||
|
|
||||||
|
declare i32 @func()
|
||||||
|
|
||||||
|
!llvm.dbg.cu = !{!0}
|
||||||
|
!llvm.module.flags = !{!7, !8, !9, !10, !11}
|
||||||
|
!llvm.ident = !{!12}
|
||||||
|
|
||||||
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 242129)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
|
||||||
|
!1 = !DIFile(filename: "foo.c", directory: "/tmp")
|
||||||
|
!2 = !{}
|
||||||
|
!3 = !{!4}
|
||||||
|
!4 = distinct !DISubprogram(name: "prologue_end_test", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, function: void ()* @prologue_end_test, variables: !2)
|
||||||
|
!5 = !DISubroutineType(types: !6)
|
||||||
|
!6 = !{null}
|
||||||
|
!7 = !{i32 2, !"Dwarf Version", i32 2}
|
||||||
|
!8 = !{i32 2, !"Debug Info Version", i32 3}
|
||||||
|
!9 = !{i32 1, !"wchar_size", i32 4}
|
||||||
|
!10 = !{i32 1, !"min_enum_size", i32 4}
|
||||||
|
!11 = !{i32 1, !"PIC Level", i32 2}
|
||||||
|
!12 = !{!"clang version 3.7.0 (trunk 242129)"}
|
||||||
|
!13 = !DILocation(line: 3, column: 3, scope: !4)
|
||||||
|
!14 = !DILocation(line: 4, column: 3, scope: !4)
|
||||||
|
!15 = !DILocation(line: 5, column: 1, scope: !4)
|
|
@ -0,0 +1,41 @@
|
||||||
|
; RUN: llc -disable-fp-elim -O0 %s -mtriple sparc -o - | FileCheck %s
|
||||||
|
|
||||||
|
; int func(void);
|
||||||
|
; void prologue_end_test() {
|
||||||
|
; func();
|
||||||
|
; func();
|
||||||
|
; }
|
||||||
|
|
||||||
|
define void @prologue_end_test() nounwind uwtable {
|
||||||
|
; CHECK: prologue_end_test:
|
||||||
|
; CHECK: .cfi_startproc
|
||||||
|
; CHECK: save %sp
|
||||||
|
; CHECK: .loc 1 3 3 prologue_end
|
||||||
|
; CHECK: call func
|
||||||
|
; CHECK: call func
|
||||||
|
entry:
|
||||||
|
%call = call i32 @func(), !dbg !11
|
||||||
|
%call1 = call i32 @func(), !dbg !12
|
||||||
|
ret void, !dbg !13
|
||||||
|
}
|
||||||
|
|
||||||
|
declare i32 @func()
|
||||||
|
|
||||||
|
!llvm.dbg.cu = !{!0}
|
||||||
|
!llvm.module.flags = !{!7, !8, !9}
|
||||||
|
!llvm.ident = !{!10}
|
||||||
|
|
||||||
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 242129)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
|
||||||
|
!1 = !DIFile(filename: "foo.c", directory: "/tmp")
|
||||||
|
!2 = !{}
|
||||||
|
!3 = !{!4}
|
||||||
|
!4 = distinct !DISubprogram(name: "prologue_end_test", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, function: void ()* @prologue_end_test, variables: !2)
|
||||||
|
!5 = !DISubroutineType(types: !6)
|
||||||
|
!6 = !{null}
|
||||||
|
!7 = !{i32 2, !"Dwarf Version", i32 2}
|
||||||
|
!8 = !{i32 2, !"Debug Info Version", i32 3}
|
||||||
|
!9 = !{i32 1, !"PIC Level", i32 2}
|
||||||
|
!10 = !{!"clang version 3.7.0 (trunk 242129)"}
|
||||||
|
!11 = !DILocation(line: 3, column: 3, scope: !4)
|
||||||
|
!12 = !DILocation(line: 4, column: 3, scope: !4)
|
||||||
|
!13 = !DILocation(line: 5, column: 1, scope: !4)
|
|
@ -0,0 +1,42 @@
|
||||||
|
; RUN: llc -disable-fp-elim -O0 %s -mtriple s390x-linux-gnu -o - | FileCheck %s
|
||||||
|
|
||||||
|
; int func(void);
|
||||||
|
; void prologue_end_test() {
|
||||||
|
; func();
|
||||||
|
; func();
|
||||||
|
; }
|
||||||
|
|
||||||
|
define void @prologue_end_test() nounwind uwtable {
|
||||||
|
; CHECK: prologue_end_test:
|
||||||
|
; CHECK: .cfi_startproc
|
||||||
|
; CHECK: aghi
|
||||||
|
; CHECK: lgr
|
||||||
|
; CHECK: .loc 1 3 3 prologue_end
|
||||||
|
; CHECK: brasl {{.*}}, func
|
||||||
|
; CHECK: brasl {{.*}}, func
|
||||||
|
entry:
|
||||||
|
%call = call i32 @func(), !dbg !11
|
||||||
|
%call1 = call i32 @func(), !dbg !12
|
||||||
|
ret void, !dbg !13
|
||||||
|
}
|
||||||
|
|
||||||
|
declare i32 @func()
|
||||||
|
|
||||||
|
!llvm.dbg.cu = !{!0}
|
||||||
|
!llvm.module.flags = !{!7, !8, !9}
|
||||||
|
!llvm.ident = !{!10}
|
||||||
|
|
||||||
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 242129)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
|
||||||
|
!1 = !DIFile(filename: "foo.c", directory: "/tmp")
|
||||||
|
!2 = !{}
|
||||||
|
!3 = !{!4}
|
||||||
|
!4 = distinct !DISubprogram(name: "prologue_end_test", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: false, function: void ()* @prologue_end_test, variables: !2)
|
||||||
|
!5 = !DISubroutineType(types: !6)
|
||||||
|
!6 = !{null}
|
||||||
|
!7 = !{i32 2, !"Dwarf Version", i32 2}
|
||||||
|
!8 = !{i32 2, !"Debug Info Version", i32 3}
|
||||||
|
!9 = !{i32 1, !"PIC Level", i32 2}
|
||||||
|
!10 = !{!"clang version 3.7.0 (trunk 242129)"}
|
||||||
|
!11 = !DILocation(line: 3, column: 3, scope: !4)
|
||||||
|
!12 = !DILocation(line: 4, column: 3, scope: !4)
|
||||||
|
!13 = !DILocation(line: 5, column: 1, scope: !4)
|
Loading…
Reference in New Issue