mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-05 12:31:33 +00:00
Now that DBG_LABEL is updated, we can finally make MachineMove
contain an MCSymbol instead of a label index. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98482 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6ffcccab51
commit
2e9919a5e5
@ -22,13 +22,13 @@
|
||||
#define LLVM_CODEGEN_MACHINELOCATION_H
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MCSymbol;
|
||||
|
||||
class MachineLocation {
|
||||
private:
|
||||
bool IsRegister; // True if location is a register.
|
||||
unsigned Register; // gcc/gdb register number.
|
||||
int Offset; // Displacement if not register.
|
||||
|
||||
public:
|
||||
enum {
|
||||
// The target register number for an abstract frame pointer. The value is
|
||||
@ -36,20 +36,11 @@ public:
|
||||
VirtualFP = ~0U
|
||||
};
|
||||
MachineLocation()
|
||||
: IsRegister(false)
|
||||
, Register(0)
|
||||
, Offset(0)
|
||||
{}
|
||||
: IsRegister(false), Register(0), Offset(0) {}
|
||||
explicit MachineLocation(unsigned R)
|
||||
: IsRegister(true)
|
||||
, Register(R)
|
||||
, Offset(0)
|
||||
{}
|
||||
: IsRegister(true), Register(R), Offset(0) {}
|
||||
MachineLocation(unsigned R, int O)
|
||||
: IsRegister(false)
|
||||
, Register(R)
|
||||
, Offset(O)
|
||||
{}
|
||||
: IsRegister(false), Register(R), Offset(O) {}
|
||||
|
||||
// Accessors
|
||||
bool isReg() const { return IsRegister; }
|
||||
@ -74,29 +65,24 @@ public:
|
||||
#endif
|
||||
};
|
||||
|
||||
/// MachineMove - This class represents the save or restore of a callee saved
|
||||
/// register that exception or debug info needs to know about.
|
||||
class MachineMove {
|
||||
private:
|
||||
unsigned LabelID; // Label ID number for post-instruction
|
||||
// address when result of move takes
|
||||
// effect.
|
||||
MachineLocation Destination; // Move to location.
|
||||
MachineLocation Source; // Move from location.
|
||||
/// Label - Symbol for post-instruction address when result of move takes
|
||||
/// effect.
|
||||
MCSymbol *Label;
|
||||
|
||||
// Move to & from location.
|
||||
MachineLocation Destination, Source;
|
||||
public:
|
||||
MachineMove()
|
||||
: LabelID(0)
|
||||
, Destination()
|
||||
, Source()
|
||||
{}
|
||||
MachineMove() : Label(0) {}
|
||||
|
||||
MachineMove(unsigned ID, MachineLocation &D, MachineLocation &S)
|
||||
: LabelID(ID)
|
||||
, Destination(D)
|
||||
, Source(S)
|
||||
{}
|
||||
MachineMove(MCSymbol *label, MachineLocation &D, MachineLocation &S)
|
||||
: Label(label), Destination(D), Source(S) {}
|
||||
|
||||
// Accessors
|
||||
unsigned getLabelID() const { return LabelID; }
|
||||
MCSymbol *getLabel() const { return Label; }
|
||||
const MachineLocation &getDestination() const { return Destination; }
|
||||
const MachineLocation &getSource() const { return Source; }
|
||||
};
|
||||
|
@ -247,13 +247,9 @@ void DwarfPrinter::EmitFrameMoves(MCSymbol *BaseLabel,
|
||||
|
||||
for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
|
||||
const MachineMove &Move = Moves[i];
|
||||
MCSymbol *Label = 0;
|
||||
unsigned LabelID = Move.getLabelID();
|
||||
MCSymbol *Label = Move.getLabel();
|
||||
// Throw out move if the label is invalid.
|
||||
if (LabelID) {
|
||||
Label = getDWLabel("label", LabelID);
|
||||
if (!Label->isDefined()) continue; // Not emitted, in dead code.
|
||||
}
|
||||
if (Label && !Label->isDefined()) continue; // Not emitted, in dead code.
|
||||
|
||||
const MachineLocation &Dst = Move.getDestination();
|
||||
const MachineLocation &Src = Move.getSource();
|
||||
|
@ -68,32 +68,29 @@ JITDwarfEmitter::EmitFrameMoves(intptr_t BaseLabelPtr,
|
||||
unsigned PointerSize = TD->getPointerSize();
|
||||
int stackGrowth = stackGrowthDirection == TargetFrameInfo::StackGrowsUp ?
|
||||
PointerSize : -PointerSize;
|
||||
bool IsLocal = false;
|
||||
unsigned BaseLabelID = 0;
|
||||
MCSymbol *BaseLabel = 0;
|
||||
|
||||
for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
|
||||
const MachineMove &Move = Moves[i];
|
||||
unsigned LabelID = Move.getLabelID();
|
||||
MCSymbol *Label = LabelID ? MMI->getLabelSym(LabelID) : 0;
|
||||
MCSymbol *Label = Move.getLabel();
|
||||
|
||||
// Throw out move if the label is invalid.
|
||||
if (Label && !Label->isDefined())
|
||||
continue;
|
||||
|
||||
intptr_t LabelPtr = 0;
|
||||
if (LabelID) LabelPtr = JCE->getLabelAddress(Label);
|
||||
if (Label) LabelPtr = JCE->getLabelAddress(Label);
|
||||
|
||||
const MachineLocation &Dst = Move.getDestination();
|
||||
const MachineLocation &Src = Move.getSource();
|
||||
|
||||
// Advance row if new location.
|
||||
if (BaseLabelPtr && LabelID && (BaseLabelID != LabelID || !IsLocal)) {
|
||||
if (BaseLabelPtr && Label && BaseLabel != Label) {
|
||||
JCE->emitByte(dwarf::DW_CFA_advance_loc4);
|
||||
JCE->emitInt32(LabelPtr - BaseLabelPtr);
|
||||
|
||||
BaseLabelID = LabelID;
|
||||
BaseLabel = Label;
|
||||
BaseLabelPtr = LabelPtr;
|
||||
IsLocal = true;
|
||||
}
|
||||
|
||||
// If advancing cfa.
|
||||
@ -712,21 +709,20 @@ JITDwarfEmitter::GetFrameMovesSizeInBytes(intptr_t BaseLabelPtr,
|
||||
|
||||
for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
|
||||
const MachineMove &Move = Moves[i];
|
||||
unsigned LabelID = Move.getLabelID();
|
||||
MCSymbol *Label = LabelID ? MMI->getLabelSym(LabelID) : 0;
|
||||
MCSymbol *Label = Move.getLabel();
|
||||
|
||||
// Throw out move if the label is invalid.
|
||||
if (Label && !Label->isDefined())
|
||||
continue;
|
||||
|
||||
intptr_t LabelPtr = 0;
|
||||
if (LabelID) LabelPtr = JCE->getLabelAddress(Label);
|
||||
if (Label) LabelPtr = JCE->getLabelAddress(Label);
|
||||
|
||||
const MachineLocation &Dst = Move.getDestination();
|
||||
const MachineLocation &Src = Move.getSource();
|
||||
|
||||
// Advance row if new location.
|
||||
if (BaseLabelPtr && LabelID && (BaseLabelPtr != LabelPtr || !IsLocal)) {
|
||||
if (BaseLabelPtr && Label && (BaseLabelPtr != LabelPtr || !IsLocal)) {
|
||||
FinalSize++;
|
||||
FinalSize += PointerSize;
|
||||
BaseLabelPtr = LabelPtr;
|
||||
|
@ -436,7 +436,7 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const
|
||||
|
||||
// Prepare for debug frame info.
|
||||
bool hasDebugInfo = MMI && MMI->hasDebugInfo();
|
||||
unsigned FrameLabelId = 0;
|
||||
MCSymbol *FrameLabel = 0;
|
||||
|
||||
// Move MBBI back to the beginning of the function.
|
||||
MBBI = MBB.begin();
|
||||
@ -452,9 +452,8 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const
|
||||
FrameSize = -(FrameSize + SPUFrameInfo::minStackSize());
|
||||
if (hasDebugInfo) {
|
||||
// Mark effective beginning of when frame pointer becomes valid.
|
||||
FrameLabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(FrameLabelId));
|
||||
FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)).addSym(FrameLabel);
|
||||
}
|
||||
|
||||
// Adjust stack pointer, spilling $lr -> 16($sp) and $sp -> -FrameSize($sp)
|
||||
@ -501,7 +500,7 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const
|
||||
// Show update of SP.
|
||||
MachineLocation SPDst(MachineLocation::VirtualFP);
|
||||
MachineLocation SPSrc(MachineLocation::VirtualFP, -FrameSize);
|
||||
Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, SPDst, SPSrc));
|
||||
|
||||
// Add callee saved registers to move list.
|
||||
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
|
||||
@ -511,17 +510,16 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const
|
||||
if (Reg == SPU::R0) continue;
|
||||
MachineLocation CSDst(MachineLocation::VirtualFP, Offset);
|
||||
MachineLocation CSSrc(Reg);
|
||||
Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, CSDst, CSSrc));
|
||||
}
|
||||
|
||||
// Mark effective beginning of when frame pointer is ready.
|
||||
unsigned ReadyLabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(ReadyLabelId));
|
||||
MCSymbol *ReadyLabel = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)).addSym(ReadyLabel);
|
||||
|
||||
MachineLocation FPDst(SPU::R1);
|
||||
MachineLocation FPSrc(MachineLocation::VirtualFP);
|
||||
Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc));
|
||||
Moves.push_back(MachineMove(ReadyLabel, FPDst, FPSrc));
|
||||
}
|
||||
} else {
|
||||
// This is a leaf function -- insert a branch hint iff there are
|
||||
|
@ -1287,7 +1287,7 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
UnwindTablesMandatory;
|
||||
|
||||
// Prepare for frame info.
|
||||
unsigned FrameLabelId = 0;
|
||||
MCSymbol *FrameLabel = 0;
|
||||
|
||||
// Scan the prolog, looking for an UPDATE_VRSAVE instruction. If we find it,
|
||||
// process it.
|
||||
@ -1446,34 +1446,33 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
// reverse order.
|
||||
if (needsFrameMoves) {
|
||||
// Mark effective beginning of when frame pointer becomes valid.
|
||||
FrameLabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, dl, TII.get(PPC::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(FrameLabelId));
|
||||
FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, dl, TII.get(PPC::DBG_LABEL)).addSym(FrameLabel);
|
||||
|
||||
// Show update of SP.
|
||||
if (NegFrameSize) {
|
||||
MachineLocation SPDst(MachineLocation::VirtualFP);
|
||||
MachineLocation SPSrc(MachineLocation::VirtualFP, NegFrameSize);
|
||||
Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, SPDst, SPSrc));
|
||||
} else {
|
||||
MachineLocation SP(isPPC64 ? PPC::X31 : PPC::R31);
|
||||
Moves.push_back(MachineMove(FrameLabelId, SP, SP));
|
||||
Moves.push_back(MachineMove(FrameLabel, SP, SP));
|
||||
}
|
||||
|
||||
if (HasFP) {
|
||||
MachineLocation FPDst(MachineLocation::VirtualFP, FPOffset);
|
||||
MachineLocation FPSrc(isPPC64 ? PPC::X31 : PPC::R31);
|
||||
Moves.push_back(MachineMove(FrameLabelId, FPDst, FPSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, FPDst, FPSrc));
|
||||
}
|
||||
|
||||
if (MustSaveLR) {
|
||||
MachineLocation LRDst(MachineLocation::VirtualFP, LROffset);
|
||||
MachineLocation LRSrc(isPPC64 ? PPC::LR8 : PPC::LR);
|
||||
Moves.push_back(MachineMove(FrameLabelId, LRDst, LRSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, LRDst, LRSrc));
|
||||
}
|
||||
}
|
||||
|
||||
unsigned ReadyLabelId = 0;
|
||||
MCSymbol *ReadyLabel = 0;
|
||||
|
||||
// If there is a frame pointer, copy R1 into R31
|
||||
if (HasFP) {
|
||||
@ -1488,21 +1487,20 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
}
|
||||
|
||||
if (needsFrameMoves) {
|
||||
ReadyLabelId = MMI->NextLabelID();
|
||||
ReadyLabel = MMI->getLabelSym(MMI->NextLabelID());
|
||||
|
||||
// Mark effective beginning of when frame pointer is ready.
|
||||
BuildMI(MBB, MBBI, dl, TII.get(PPC::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(ReadyLabelId));
|
||||
BuildMI(MBB, MBBI, dl, TII.get(PPC::DBG_LABEL)).addSym(ReadyLabel);
|
||||
|
||||
MachineLocation FPDst(HasFP ? (isPPC64 ? PPC::X31 : PPC::R31) :
|
||||
(isPPC64 ? PPC::X1 : PPC::R1));
|
||||
MachineLocation FPSrc(MachineLocation::VirtualFP);
|
||||
Moves.push_back(MachineMove(ReadyLabelId, FPDst, FPSrc));
|
||||
Moves.push_back(MachineMove(ReadyLabel, FPDst, FPSrc));
|
||||
}
|
||||
}
|
||||
|
||||
if (needsFrameMoves) {
|
||||
unsigned LabelId = HasFP ? ReadyLabelId : FrameLabelId;
|
||||
MCSymbol *Label = HasFP ? ReadyLabel : FrameLabel;
|
||||
|
||||
// Add callee saved registers to move list.
|
||||
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
|
||||
@ -1512,7 +1510,7 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
if (Reg == PPC::LR || Reg == PPC::LR8 || Reg == PPC::RM) continue;
|
||||
MachineLocation CSDst(MachineLocation::VirtualFP, Offset);
|
||||
MachineLocation CSSrc(Reg);
|
||||
Moves.push_back(MachineMove(LabelId, CSDst, CSSrc));
|
||||
Moves.push_back(MachineMove(Label, CSDst, CSSrc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -797,7 +797,7 @@ static int mergeSPUpdates(MachineBasicBlock &MBB,
|
||||
}
|
||||
|
||||
void X86RegisterInfo::emitCalleeSavedFrameMoves(MachineFunction &MF,
|
||||
unsigned LabelId,
|
||||
MCSymbol *Label,
|
||||
unsigned FramePtr) const {
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
MachineModuleInfo *MMI = MFI->getMachineModuleInfo();
|
||||
@ -860,7 +860,7 @@ void X86RegisterInfo::emitCalleeSavedFrameMoves(MachineFunction &MF,
|
||||
|
||||
MachineLocation CSDst(MachineLocation::VirtualFP, Offset);
|
||||
MachineLocation CSSrc(Reg);
|
||||
Moves.push_back(MachineMove(LabelId, CSDst, CSSrc));
|
||||
Moves.push_back(MachineMove(Label, CSDst, CSSrc));
|
||||
}
|
||||
}
|
||||
|
||||
@ -959,26 +959,25 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
|
||||
if (needsFrameMoves) {
|
||||
// Mark the place where EBP/RBP was saved.
|
||||
unsigned FrameLabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(FrameLabelId));
|
||||
MCSymbol *FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addSym(FrameLabel);
|
||||
|
||||
// Define the current CFA rule to use the provided offset.
|
||||
if (StackSize) {
|
||||
MachineLocation SPDst(MachineLocation::VirtualFP);
|
||||
MachineLocation SPSrc(MachineLocation::VirtualFP, 2 * stackGrowth);
|
||||
Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, SPDst, SPSrc));
|
||||
} else {
|
||||
// FIXME: Verify & implement for FP
|
||||
MachineLocation SPDst(StackPtr);
|
||||
MachineLocation SPSrc(StackPtr, stackGrowth);
|
||||
Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, SPDst, SPSrc));
|
||||
}
|
||||
|
||||
// Change the rule for the FramePtr to be an "offset" rule.
|
||||
MachineLocation FPDst(MachineLocation::VirtualFP, 2 * stackGrowth);
|
||||
MachineLocation FPSrc(FramePtr);
|
||||
Moves.push_back(MachineMove(FrameLabelId, FPDst, FPSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, FPDst, FPSrc));
|
||||
}
|
||||
|
||||
// Update EBP with the new base value...
|
||||
@ -988,14 +987,13 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
|
||||
if (needsFrameMoves) {
|
||||
// Mark effective beginning of when frame pointer becomes valid.
|
||||
unsigned FrameLabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(FrameLabelId));
|
||||
MCSymbol *FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addSym(FrameLabel);
|
||||
|
||||
// Define the current CFA to use the EBP/RBP register.
|
||||
MachineLocation FPDst(FramePtr);
|
||||
MachineLocation FPSrc(MachineLocation::VirtualFP);
|
||||
Moves.push_back(MachineMove(FrameLabelId, FPDst, FPSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, FPDst, FPSrc));
|
||||
}
|
||||
|
||||
// Mark the FramePtr as live-in in every block except the entry.
|
||||
@ -1029,16 +1027,15 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
|
||||
if (!HasFP && needsFrameMoves) {
|
||||
// Mark callee-saved push instruction.
|
||||
unsigned LabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(LabelId));
|
||||
MCSymbol *Label = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addSym(Label);
|
||||
|
||||
// Define the current CFA rule to use the provided offset.
|
||||
unsigned Ptr = StackSize ?
|
||||
MachineLocation::VirtualFP : StackPtr;
|
||||
MachineLocation SPDst(Ptr);
|
||||
MachineLocation SPSrc(Ptr, StackOffset);
|
||||
Moves.push_back(MachineMove(LabelId, SPDst, SPSrc));
|
||||
Moves.push_back(MachineMove(Label, SPDst, SPSrc));
|
||||
StackOffset += stackGrowth;
|
||||
}
|
||||
}
|
||||
@ -1102,9 +1099,8 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
|
||||
if ((NumBytes || PushedRegs) && needsFrameMoves) {
|
||||
// Mark end of stack pointer adjustment.
|
||||
unsigned LabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(LabelId));
|
||||
MCSymbol *Label = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addSym(Label);
|
||||
|
||||
if (!HasFP && NumBytes) {
|
||||
// Define the current CFA rule to use the provided offset.
|
||||
@ -1112,18 +1108,18 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
MachineLocation SPDst(MachineLocation::VirtualFP);
|
||||
MachineLocation SPSrc(MachineLocation::VirtualFP,
|
||||
-StackSize + stackGrowth);
|
||||
Moves.push_back(MachineMove(LabelId, SPDst, SPSrc));
|
||||
Moves.push_back(MachineMove(Label, SPDst, SPSrc));
|
||||
} else {
|
||||
// FIXME: Verify & implement for FP
|
||||
MachineLocation SPDst(StackPtr);
|
||||
MachineLocation SPSrc(StackPtr, stackGrowth);
|
||||
Moves.push_back(MachineMove(LabelId, SPDst, SPSrc));
|
||||
Moves.push_back(MachineMove(Label, SPDst, SPSrc));
|
||||
}
|
||||
}
|
||||
|
||||
// Emit DWARF info specifying the offsets of the callee-saved registers.
|
||||
if (PushedRegs)
|
||||
emitCalleeSavedFrameMoves(MF, LabelId, HasFP ? FramePtr : StackPtr);
|
||||
emitCalleeSavedFrameMoves(MF, Label, HasFP ? FramePtr : StackPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public:
|
||||
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||
RegScavenger *RS = NULL) const;
|
||||
|
||||
void emitCalleeSavedFrameMoves(MachineFunction &MF, unsigned LabelId,
|
||||
void emitCalleeSavedFrameMoves(MachineFunction &MF, MCSymbol *Label,
|
||||
unsigned FramePtr) const;
|
||||
void emitPrologue(MachineFunction &MF) const;
|
||||
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
|
||||
|
@ -429,11 +429,9 @@ bool XCoreInstrInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB,
|
||||
storeRegToStackSlot(MBB, MI, it->getReg(), true,
|
||||
it->getFrameIdx(), it->getRegClass());
|
||||
if (emitFrameMoves) {
|
||||
unsigned SaveLabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MI, DL, get(XCore::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(SaveLabelId));
|
||||
XFI->getSpillLabels().push_back(
|
||||
std::pair<unsigned, CalleeSavedInfo>(SaveLabelId, *it));
|
||||
MCSymbol *SaveLabel = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MI, DL, get(XCore::DBG_LABEL)).addSym(SaveLabel);
|
||||
XFI->getSpillLabels().push_back(std::make_pair(SaveLabel, *it));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -31,7 +31,7 @@ private:
|
||||
int LRSpillSlot;
|
||||
int FPSpillSlot;
|
||||
int VarArgsFrameIndex;
|
||||
std::vector<std::pair<unsigned, CalleeSavedInfo> > SpillLabels;
|
||||
std::vector<std::pair<MCSymbol*, CalleeSavedInfo> > SpillLabels;
|
||||
|
||||
public:
|
||||
XCoreFunctionInfo() :
|
||||
@ -60,7 +60,7 @@ public:
|
||||
void setFPSpillSlot(int off) { FPSpillSlot = off; }
|
||||
int getFPSpillSlot() const { return FPSpillSlot; }
|
||||
|
||||
std::vector<std::pair<unsigned, CalleeSavedInfo> >&getSpillLabels() {
|
||||
std::vector<std::pair<MCSymbol*, CalleeSavedInfo> > &getSpillLabels() {
|
||||
return SpillLabels;
|
||||
}
|
||||
};
|
||||
|
@ -456,18 +456,17 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
std::vector<MachineMove> &Moves = MMI->getFrameMoves();
|
||||
|
||||
// Show update of SP.
|
||||
unsigned FrameLabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(FrameLabelId));
|
||||
MCSymbol *FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addSym(FrameLabel);
|
||||
|
||||
MachineLocation SPDst(MachineLocation::VirtualFP);
|
||||
MachineLocation SPSrc(MachineLocation::VirtualFP, -FrameSize * 4);
|
||||
Moves.push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, SPDst, SPSrc));
|
||||
|
||||
if (LRSavedOnEntry) {
|
||||
MachineLocation CSDst(MachineLocation::VirtualFP, 0);
|
||||
MachineLocation CSSrc(XCore::LR);
|
||||
Moves.push_back(MachineMove(FrameLabelId, CSDst, CSSrc));
|
||||
Moves.push_back(MachineMove(FrameLabel, CSDst, CSSrc));
|
||||
}
|
||||
}
|
||||
if (saveLR) {
|
||||
@ -476,13 +475,11 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
MBB.addLiveIn(XCore::LR);
|
||||
|
||||
if (emitFrameMoves) {
|
||||
unsigned SaveLRLabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(SaveLRLabelId));
|
||||
MCSymbol *SaveLRLabel = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addSym(SaveLRLabel);
|
||||
MachineLocation CSDst(MachineLocation::VirtualFP, LRSpillOffset);
|
||||
MachineLocation CSSrc(XCore::LR);
|
||||
MMI->getFrameMoves().push_back(MachineMove(SaveLRLabelId,
|
||||
CSDst, CSSrc));
|
||||
MMI->getFrameMoves().push_back(MachineMove(SaveLRLabel, CSDst, CSSrc));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -494,13 +491,11 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
// R10 is live-in. It is killed at the spill.
|
||||
MBB.addLiveIn(XCore::R10);
|
||||
if (emitFrameMoves) {
|
||||
unsigned SaveR10LabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(SaveR10LabelId));
|
||||
MCSymbol *SaveR10Label = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addSym(SaveR10Label);
|
||||
MachineLocation CSDst(MachineLocation::VirtualFP, FPSpillOffset);
|
||||
MachineLocation CSSrc(XCore::R10);
|
||||
MMI->getFrameMoves().push_back(MachineMove(SaveR10LabelId,
|
||||
CSDst, CSSrc));
|
||||
MMI->getFrameMoves().push_back(MachineMove(SaveR10Label, CSDst, CSSrc));
|
||||
}
|
||||
// Set the FP from the SP.
|
||||
unsigned FramePtr = XCore::R10;
|
||||
@ -508,22 +503,21 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
.addImm(0);
|
||||
if (emitFrameMoves) {
|
||||
// Show FP is now valid.
|
||||
unsigned FrameLabelId = MMI->NextLabelID();
|
||||
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL))
|
||||
.addSym(MMI->getLabelSym(FrameLabelId));
|
||||
MCSymbol *FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
|
||||
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addSym(FrameLabel);
|
||||
MachineLocation SPDst(FramePtr);
|
||||
MachineLocation SPSrc(MachineLocation::VirtualFP);
|
||||
MMI->getFrameMoves().push_back(MachineMove(FrameLabelId, SPDst, SPSrc));
|
||||
MMI->getFrameMoves().push_back(MachineMove(FrameLabel, SPDst, SPSrc));
|
||||
}
|
||||
}
|
||||
|
||||
if (emitFrameMoves) {
|
||||
// Frame moves for callee saved.
|
||||
std::vector<MachineMove> &Moves = MMI->getFrameMoves();
|
||||
std::vector<std::pair<unsigned, CalleeSavedInfo> >&SpillLabels =
|
||||
std::vector<std::pair<MCSymbol*, CalleeSavedInfo> >&SpillLabels =
|
||||
XFI->getSpillLabels();
|
||||
for (unsigned I = 0, E = SpillLabels.size(); I != E; ++I) {
|
||||
unsigned SpillLabel = SpillLabels[I].first;
|
||||
MCSymbol *SpillLabel = SpillLabels[I].first;
|
||||
CalleeSavedInfo &CSI = SpillLabels[I].second;
|
||||
int Offset = MFI->getObjectOffset(CSI.getFrameIdx());
|
||||
unsigned Reg = CSI.getReg();
|
||||
|
Loading…
Reference in New Issue
Block a user