From c618c8aff46a8ec4d209d041404e780a0caaf77d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 26 Jan 2010 21:53:08 +0000 Subject: emit jump table an alias ".set" directives through MCStreamer as assignments. .set x, a-b is the same as: x = a-b git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94596 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/CodeGen/AsmPrinter/AsmPrinter.cpp') diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index d2c1721012..50e88773e8 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -336,7 +336,9 @@ bool AsmPrinter::doFinalization(Module &M) { printVisibility(Name, I->getVisibility()); - O << "\t.set\t" << *Name << ", " << *Target << '\n'; + // Emit the directives as assignments aka .set: + OutStreamer.EmitAssignment(Name, + MCSymbolRefExpr::Create(Target, OutContext)); } } @@ -525,9 +527,11 @@ void AsmPrinter::EmitJumpTableInfo(MachineFunction &MF) { const MachineBasicBlock *MBB = JTBBs[ii]; if (!EmittedSets.insert(MBB)) continue; - O << "\t.set\t" - << *GetJTSetSymbol(JTI, MBB->getNumber()) << ',' - << *MBB->getSymbol(OutContext) << '-' << *Base << '\n'; + // .set LJTSet, LBB32-base + const MCExpr *LHS = + MCSymbolRefExpr::Create(MBB->getSymbol(OutContext), OutContext); + OutStreamer.EmitAssignment(GetJTSetSymbol(JTI, MBB->getNumber()), + MCBinaryExpr::CreateSub(LHS, Base, OutContext)); } } -- cgit v1.2.3-70-g09d2