From ba3b320aa3ea59432550a4306b185c92c5e348e1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 14 Mar 2010 07:56:48 +0000 Subject: [PATCH] change the DBG_LABEL MachineInstr to always be created with an MCSymbol instead of an immediate. llvm-svn: 98481 --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 8 +------- lib/Target/ARM/ARMCodeEmitter.cpp | 2 -- lib/Target/CellSPU/SPURegisterInfo.cpp | 9 ++++++--- lib/Target/PowerPC/PPCCodeEmitter.cpp | 2 -- lib/Target/PowerPC/PPCRegisterInfo.cpp | 6 ++++-- lib/Target/X86/X86CodeEmitter.cpp | 2 -- lib/Target/X86/X86RegisterInfo.cpp | 12 ++++++++---- lib/Target/XCore/XCoreInstrInfo.cpp | 3 ++- lib/Target/XCore/XCoreRegisterInfo.cpp | 12 ++++++++---- 9 files changed, 29 insertions(+), 27 deletions(-) diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 66a2eee7a78..f2056008823 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1553,13 +1553,7 @@ void AsmPrinter::printKill(const MachineInstr *MI) const { /// printLabel - This method prints a local label used by debug and /// exception handling tables. void AsmPrinter::printLabelInst(const MachineInstr *MI) const { - MCSymbol *Sym; - - if (MI->getOperand(0).isMCSymbol()) - Sym = MI->getOperand(0).getMCSymbol(); - else - Sym = MMI->getLabelSym(MI->getOperand(0).getImm()); - OutStreamer.EmitLabel(Sym); + OutStreamer.EmitLabel(MI->getOperand(0).getMCSymbol()); } void AsmPrinter::printLabel(unsigned Id) const { diff --git a/lib/Target/ARM/ARMCodeEmitter.cpp b/lib/Target/ARM/ARMCodeEmitter.cpp index e3b1dda39c9..334c820b91c 100644 --- a/lib/Target/ARM/ARMCodeEmitter.cpp +++ b/lib/Target/ARM/ARMCodeEmitter.cpp @@ -564,8 +564,6 @@ void ARMCodeEmitter::emitPseudoInstruction(const MachineInstr &MI) { break; } case TargetOpcode::DBG_LABEL: - MCE.emitLabel(MMI->getLabelSym(MI.getOperand(0).getImm())); - break; case TargetOpcode::EH_LABEL: MCE.emitLabel(MI.getOperand(0).getMCSymbol()); break; diff --git a/lib/Target/CellSPU/SPURegisterInfo.cpp b/lib/Target/CellSPU/SPURegisterInfo.cpp index 4ba0cb13dff..915389c3313 100644 --- a/lib/Target/CellSPU/SPURegisterInfo.cpp +++ b/lib/Target/CellSPU/SPURegisterInfo.cpp @@ -453,7 +453,8 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const if (hasDebugInfo) { // Mark effective beginning of when frame pointer becomes valid. FrameLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)).addImm(FrameLabelId); + BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)) + .addSym(MMI->getLabelSym(FrameLabelId)); } // Adjust stack pointer, spilling $lr -> 16($sp) and $sp -> -FrameSize($sp) @@ -515,7 +516,8 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const // Mark effective beginning of when frame pointer is ready. unsigned ReadyLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)).addImm(ReadyLabelId); + BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)) + .addSym(MMI->getLabelSym(ReadyLabelId)); MachineLocation FPDst(SPU::R1); MachineLocation FPSrc(MachineLocation::VirtualFP); @@ -531,7 +533,8 @@ void SPURegisterInfo::emitPrologue(MachineFunction &MF) const // Insert terminator label unsigned BranchLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)).addImm(BranchLabelId); + BuildMI(MBB, MBBI, dl, TII.get(SPU::DBG_LABEL)) + .addSym(MMI->getLabelSym(BranchLabelId)); } } } diff --git a/lib/Target/PowerPC/PPCCodeEmitter.cpp b/lib/Target/PowerPC/PPCCodeEmitter.cpp index 6c4cf800a55..f7c27d40a5b 100644 --- a/lib/Target/PowerPC/PPCCodeEmitter.cpp +++ b/lib/Target/PowerPC/PPCCodeEmitter.cpp @@ -111,8 +111,6 @@ void PPCCodeEmitter::emitBasicBlock(MachineBasicBlock &MBB) { MCE.emitWordBE(getBinaryCodeForInstr(MI)); break; case TargetOpcode::DBG_LABEL: - MCE.emitLabel(MMI->getLabelSym(MI.getOperand(0).getImm())); - break; case TargetOpcode::EH_LABEL: MCE.emitLabel(MI.getOperand(0).getMCSymbol()); break; diff --git a/lib/Target/PowerPC/PPCRegisterInfo.cpp b/lib/Target/PowerPC/PPCRegisterInfo.cpp index 31bca16c864..64e4e200ee9 100644 --- a/lib/Target/PowerPC/PPCRegisterInfo.cpp +++ b/lib/Target/PowerPC/PPCRegisterInfo.cpp @@ -1447,7 +1447,8 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const { if (needsFrameMoves) { // Mark effective beginning of when frame pointer becomes valid. FrameLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, dl, TII.get(PPC::DBG_LABEL)).addImm(FrameLabelId); + BuildMI(MBB, MBBI, dl, TII.get(PPC::DBG_LABEL)) + .addSym(MMI->getLabelSym(FrameLabelId)); // Show update of SP. if (NegFrameSize) { @@ -1490,7 +1491,8 @@ PPCRegisterInfo::emitPrologue(MachineFunction &MF) const { ReadyLabelId = MMI->NextLabelID(); // Mark effective beginning of when frame pointer is ready. - BuildMI(MBB, MBBI, dl, TII.get(PPC::DBG_LABEL)).addImm(ReadyLabelId); + BuildMI(MBB, MBBI, dl, TII.get(PPC::DBG_LABEL)) + .addSym(MMI->getLabelSym(ReadyLabelId)); MachineLocation FPDst(HasFP ? (isPPC64 ? PPC::X31 : PPC::R31) : (isPPC64 ? PPC::X1 : PPC::R1)); diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp index 1c6f754740f..6638e110f4f 100644 --- a/lib/Target/X86/X86CodeEmitter.cpp +++ b/lib/Target/X86/X86CodeEmitter.cpp @@ -603,8 +603,6 @@ void Emitter::emitInstruction(const MachineInstr &MI, llvm_report_error("JIT does not support inline asm!"); break; case TargetOpcode::DBG_LABEL: - MCE.emitLabel(MMI->getLabelSym(MI.getOperand(0).getImm())); - break; case TargetOpcode::GC_LABEL: case TargetOpcode::EH_LABEL: MCE.emitLabel(MI.getOperand(0).getMCSymbol()); diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index f46c631e3cb..3c0607b2551 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -960,7 +960,8 @@ 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)).addImm(FrameLabelId); + BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)) + .addSym(MMI->getLabelSym(FrameLabelId)); // Define the current CFA rule to use the provided offset. if (StackSize) { @@ -988,7 +989,8 @@ 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)).addImm(FrameLabelId); + BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)) + .addSym(MMI->getLabelSym(FrameLabelId)); // Define the current CFA to use the EBP/RBP register. MachineLocation FPDst(FramePtr); @@ -1028,7 +1030,8 @@ 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)).addImm(LabelId); + BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)) + .addSym(MMI->getLabelSym(LabelId)); // Define the current CFA rule to use the provided offset. unsigned Ptr = StackSize ? @@ -1100,7 +1103,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)).addImm(LabelId); + BuildMI(MBB, MBBI, DL, TII.get(X86::DBG_LABEL)) + .addSym(MMI->getLabelSym(LabelId)); if (!HasFP && NumBytes) { // Define the current CFA rule to use the provided offset. diff --git a/lib/Target/XCore/XCoreInstrInfo.cpp b/lib/Target/XCore/XCoreInstrInfo.cpp index 722e7470f06..801116e4e8e 100644 --- a/lib/Target/XCore/XCoreInstrInfo.cpp +++ b/lib/Target/XCore/XCoreInstrInfo.cpp @@ -430,7 +430,8 @@ bool XCoreInstrInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB, it->getFrameIdx(), it->getRegClass()); if (emitFrameMoves) { unsigned SaveLabelId = MMI->NextLabelID(); - BuildMI(MBB, MI, DL, get(XCore::DBG_LABEL)).addImm(SaveLabelId); + BuildMI(MBB, MI, DL, get(XCore::DBG_LABEL)) + .addSym(MMI->getLabelSym(SaveLabelId)); XFI->getSpillLabels().push_back( std::pair(SaveLabelId, *it)); } diff --git a/lib/Target/XCore/XCoreRegisterInfo.cpp b/lib/Target/XCore/XCoreRegisterInfo.cpp index 0ab312eb276..6a00afaa4b0 100644 --- a/lib/Target/XCore/XCoreRegisterInfo.cpp +++ b/lib/Target/XCore/XCoreRegisterInfo.cpp @@ -457,7 +457,8 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const { // Show update of SP. unsigned FrameLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addImm(FrameLabelId); + BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)) + .addSym(MMI->getLabelSym(FrameLabelId)); MachineLocation SPDst(MachineLocation::VirtualFP); MachineLocation SPSrc(MachineLocation::VirtualFP, -FrameSize * 4); @@ -476,7 +477,8 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const { if (emitFrameMoves) { unsigned SaveLRLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addImm(SaveLRLabelId); + BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)) + .addSym(MMI->getLabelSym(SaveLRLabelId)); MachineLocation CSDst(MachineLocation::VirtualFP, LRSpillOffset); MachineLocation CSSrc(XCore::LR); MMI->getFrameMoves().push_back(MachineMove(SaveLRLabelId, @@ -493,7 +495,8 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const { MBB.addLiveIn(XCore::R10); if (emitFrameMoves) { unsigned SaveR10LabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addImm(SaveR10LabelId); + BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)) + .addSym(MMI->getLabelSym(SaveR10LabelId)); MachineLocation CSDst(MachineLocation::VirtualFP, FPSpillOffset); MachineLocation CSSrc(XCore::R10); MMI->getFrameMoves().push_back(MachineMove(SaveR10LabelId, @@ -506,7 +509,8 @@ void XCoreRegisterInfo::emitPrologue(MachineFunction &MF) const { if (emitFrameMoves) { // Show FP is now valid. unsigned FrameLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)).addImm(FrameLabelId); + BuildMI(MBB, MBBI, dl, TII.get(XCore::DBG_LABEL)) + .addSym(MMI->getLabelSym(FrameLabelId)); MachineLocation SPDst(FramePtr); MachineLocation SPSrc(MachineLocation::VirtualFP); MMI->getFrameMoves().push_back(MachineMove(FrameLabelId, SPDst, SPSrc));