get MMI out of the label uniquing business, just go to MCContext

to get unique assembler temporary labels.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98489 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-03-14 08:36:50 +00:00
parent 6b4205aa44
commit 63d7836267
13 changed files with 25 additions and 46 deletions

View File

@ -102,9 +102,6 @@ class MachineModuleInfo : public ImmutablePass {
/// want.
MachineModuleInfoImpl *ObjFileMMI;
/// NextLabelIDToReturn - Unique ID counter for labels.
unsigned NextLabelIDToReturn;
// FrameMoves - List of moves done by a function's prolog. Used to construct
// frame maps by debug and exception handling consumers.
std::vector<MachineMove> FrameMoves;
@ -201,21 +198,12 @@ public:
bool callsUnwindInit() const { return CallsUnwindInit; }
void setCallsUnwindInit(bool b) { CallsUnwindInit = b; }
/// NextLabelID - Return the next unique label id.
///
unsigned NextLabelID() {
return NextLabelIDToReturn++;
}
/// getLabelSym - Turn a label ID into a symbol.
MCSymbol *getLabelSym(unsigned ID);
/// getFrameMoves - Returns a reference to a list of moves done in the current
/// function's prologue. Used to construct frame maps for debug and exception
/// handling comsumers.
std::vector<MachineMove> &getFrameMoves() { return FrameMoves; }
//===-EH-----------------------------------------------------------------===//
//===- EH ---------------------------------------------------------------===//
/// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the
/// specified MachineBasicBlock.

View File

@ -1972,7 +1972,7 @@ void DwarfDebug::endScope(const MachineInstr *MI) {
if (I == DbgScopeEndMap.end())
return;
MCSymbol *Label = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *Label = MMI->getContext().CreateTempSymbol();
Asm->OutStreamer.EmitLabel(Label);
SmallVector<DbgScope*, 2> &SD = I->second;
@ -2220,7 +2220,7 @@ MCSymbol *DwarfDebug::recordSourceLine(unsigned Line, unsigned Col, MDNode *S) {
assert(0 && "Unexpected scope info");
unsigned Src = GetOrCreateSourceID(Dir, Fn);
MCSymbol *Label = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *Label = MMI->getContext().CreateTempSymbol();
Lines.push_back(SrcLineInfo(Line, Col, Src, Label));
if (TimePassesIsEnabled)

View File

@ -471,7 +471,6 @@ ComputeCallSiteTable(SmallVectorImpl<CallSiteEntry> &CallSites,
if (!MI->isLabel()) {
if (MI->getDesc().isCall())
SawPotentiallyThrowing |= !CallToNoUnwindFunction(MI);
continue;
}

View File

@ -22,7 +22,6 @@
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
@ -41,7 +40,7 @@ MachineModuleInfoImpl::~MachineModuleInfoImpl() {}
MachineModuleInfo::MachineModuleInfo(const MCAsmInfo &MAI)
: ImmutablePass(&ID), Context(MAI),
ObjFileMMI(0), NextLabelIDToReturn(1),
ObjFileMMI(0),
CurCallSite(0), CallsEHReturn(0), CallsUnwindInit(0), DbgInfoAvailable(false){
// Always emit some info, by default "no personality" info.
Personalities.push_back(NULL);
@ -70,12 +69,6 @@ bool MachineModuleInfo::doFinalization() {
return false;
}
/// getLabelSym - Turn a label ID into a symbol.
MCSymbol *MachineModuleInfo::getLabelSym(unsigned ID) {
return Context.GetOrCreateTemporarySymbol
(Twine(Context.getAsmInfo().getPrivateGlobalPrefix()) + "label" +Twine(ID));
}
/// EndFunction - Discard function meta information.
///
void MachineModuleInfo::EndFunction() {
@ -140,7 +133,7 @@ void MachineModuleInfo::addInvoke(MachineBasicBlock *LandingPad,
/// addLandingPad - Provide the label of a try LandingPad block.
///
MCSymbol *MachineModuleInfo::addLandingPad(MachineBasicBlock *LandingPad) {
MCSymbol *LandingPadLabel = getLabelSym(NextLabelID());
MCSymbol *LandingPadLabel = Context.CreateTempSymbol();
LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad);
LP.LandingPadLabel = LandingPadLabel;
return LandingPadLabel;

View File

@ -4362,7 +4362,7 @@ void SelectionDAGBuilder::LowerCallTo(CallSite CS, SDValue Callee,
if (LandingPad && MMI) {
// Insert a label before the invoke call to mark the try range. This can be
// used to detect deletion of the invoke via the MachineModuleInfo.
BeginLabel = MMI->getLabelSym(MMI->NextLabelID());
BeginLabel = MMI->getContext().CreateTempSymbol();
// For SjLj, keep track of which landing pads go with which invokes
// so as to maintain the ordering of pads in the LSDA.
@ -4464,7 +4464,7 @@ void SelectionDAGBuilder::LowerCallTo(CallSite CS, SDValue Callee,
if (LandingPad && MMI) {
// Insert a label at the end of the invoke call to mark the try range. This
// can be used to detect deletion of the invoke via the MachineModuleInfo.
MCSymbol *EndLabel = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *EndLabel = MMI->getContext().CreateTempSymbol();
DAG.setRoot(DAG.getEHLabel(getCurDebugLoc(), getRoot(), EndLabel));
// Inform MachineModuleInfo of range.

View File

@ -452,7 +452,7 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const
FrameSize = -(FrameSize + SPUFrameInfo::minStackSize());
if (hasDebugInfo) {
// Mark effective beginning of when frame pointer becomes valid.
FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
FrameLabel = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)).addSym(FrameLabel);
}
@ -514,7 +514,7 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const
}
// Mark effective beginning of when frame pointer is ready.
MCSymbol *ReadyLabel = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *ReadyLabel = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)).addSym(ReadyLabel);
MachineLocation FPDst(SPU::R1);
@ -530,9 +530,8 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const
dl = MBBI->getDebugLoc();
// Insert terminator label
unsigned BranchLabelId = MMI->NextLabelID();
BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL))
.addSym(MMI->getLabelSym(BranchLabelId));
.addSym(MMI->getContext().CreateTempSymbol());
}
}
}

View File

@ -1446,7 +1446,7 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
// reverse order.
if (needsFrameMoves) {
// Mark effective beginning of when frame pointer becomes valid.
FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
FrameLabel = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, dl, TII.get(PPC::DBG_LABEL)).addSym(FrameLabel);
// Show update of SP.
@ -1487,7 +1487,7 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const {
}
if (needsFrameMoves) {
ReadyLabel = MMI->getLabelSym(MMI->NextLabelID());
ReadyLabel = MMI->getContext().CreateTempSymbol();
// Mark effective beginning of when frame pointer is ready.
BuildMI(MBB, MBBI, dl, TII.get(PPC::DBG_LABEL)).addSym(ReadyLabel);

View File

@ -959,7 +959,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
if (needsFrameMoves) {
// Mark the place where EBP/RBP was saved.
MCSymbol *FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *FrameLabel = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addSym(FrameLabel);
// Define the current CFA rule to use the provided offset.
@ -987,7 +987,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
if (needsFrameMoves) {
// Mark effective beginning of when frame pointer becomes valid.
MCSymbol *FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *FrameLabel = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addSym(FrameLabel);
// Define the current CFA to use the EBP/RBP register.
@ -1027,7 +1027,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
if (!HasFP && needsFrameMoves) {
// Mark callee-saved push instruction.
MCSymbol *Label = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *Label = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addSym(Label);
// Define the current CFA rule to use the provided offset.
@ -1099,7 +1099,7 @@ void X86RegisterInfo::emitPrologue(MachineFunction &MF) const {
if ((NumBytes || PushedRegs) && needsFrameMoves) {
// Mark end of stack pointer adjustment.
MCSymbol *Label = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *Label = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)).addSym(Label);
if (!HasFP && NumBytes) {

View File

@ -429,7 +429,7 @@ bool XCoreInstrInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB,
storeRegToStackSlot(MBB, MI, it->getReg(), true,
it->getFrameIdx(), it->getRegClass());
if (emitFrameMoves) {
MCSymbol *SaveLabel = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *SaveLabel = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MI, DL, get(XCore::DBG_LABEL)).addSym(SaveLabel);
XFI->getSpillLabels().push_back(std::make_pair(SaveLabel, *it));
}

View File

@ -456,7 +456,7 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const {
std::vector<MachineMove> &Moves = MMI->getFrameMoves();
// Show update of SP.
MCSymbol *FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *FrameLabel = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addSym(FrameLabel);
MachineLocation SPDst(MachineLocation::VirtualFP);
@ -475,7 +475,7 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const {
MBB.addLiveIn(XCore::LR);
if (emitFrameMoves) {
MCSymbol *SaveLRLabel = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *SaveLRLabel = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addSym(SaveLRLabel);
MachineLocation CSDst(MachineLocation::VirtualFP, LRSpillOffset);
MachineLocation CSSrc(XCore::LR);
@ -491,7 +491,7 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const {
// R10 is live-in. It is killed at the spill.
MBB.addLiveIn(XCore::R10);
if (emitFrameMoves) {
MCSymbol *SaveR10Label = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *SaveR10Label = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addSym(SaveR10Label);
MachineLocation CSDst(MachineLocation::VirtualFP, FPSpillOffset);
MachineLocation CSSrc(XCore::R10);
@ -503,7 +503,7 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const {
.addImm(0);
if (emitFrameMoves) {
// Show FP is now valid.
MCSymbol *FrameLabel = MMI->getLabelSym(MMI->NextLabelID());
MCSymbol *FrameLabel = MMI->getContext().CreateTempSymbol();
BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addSym(FrameLabel);
MachineLocation SPDst(FramePtr);
MachineLocation SPSrc(MachineLocation::VirtualFP);

View File

@ -5,9 +5,9 @@ define i32 @_Z4funci(i32 %a) ssp {
; CHECK-NEXT: stw r31, -4(r1)
; CHECK-NEXT: stw r0, 8(r1)
; CHECK-NEXT: stwu r1, -80(r1)
; CHECK-NEXT: Llabel1:
; CHECK-NEXT: Ltmp0:
; CHECK-NEXT: mr r31, r1
; CHECK-NEXT: Llabel2:
; CHECK-NEXT: Ltmp1:
entry:
%a_addr = alloca i32 ; <i32*> [#uses=2]
%retval = alloca i32 ; <i32*> [#uses=2]

View File

@ -28,5 +28,5 @@ lpad: ; preds = %cont, %entry
}
; CHECK: call{{.*}}f
; CHECK-NEXT: Llabel1:
; CHECK-NEXT: Ltmp0:
; CHECK-NEXT: movl %eax, %esi

View File

@ -21,4 +21,4 @@ lpad: ; preds = %cont, %entry
}
; CHECK: lpad
; CHECK-NEXT: Llabel
; CHECK-NEXT: Ltmp