diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-26 21:53:08 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-26 21:53:08 +0000 |
commit | b657c4cdc3f37717851a5be12350f2296fd8c3bd (patch) | |
tree | 9bd020802dd94f5a676c5474decdd5f81566425d /llvm/lib | |
parent | 37bc78a5e2c1044fe4ff9568cd41eba2a61580c6 (diff) | |
download | bcm5719-llvm-b657c4cdc3f37717851a5be12350f2296fd8c3bd.tar.gz bcm5719-llvm-b657c4cdc3f37717851a5be12350f2296fd8c3bd.zip |
emit jump table an alias ".set" directives through MCStreamer as
assignments.
.set x, a-b
is the same as:
x = a-b
llvm-svn: 94596
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index d2c1721012a..50e88773e8b 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/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)); } } diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp index f659c51908b..415390bc281 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfPrinter.cpp @@ -201,6 +201,7 @@ void DwarfPrinter::EmitDifference(const char *TagHi, unsigned NumberHi, const char *TagLo, unsigned NumberLo, bool IsSmall) { if (MAI->hasSetDirective()) { + // FIXME: switch to OutStreamer.EmitAssignment. O << "\t.set\t"; PrintLabelName("set", SetCounter, Flavor); O << ","; @@ -232,6 +233,7 @@ void DwarfPrinter::EmitSectionOffset(const char* Label, const char* Section, printAbsolute = MAI->isAbsoluteDebugSectionOffsets(); if (MAI->hasSetDirective() && useSet) { + // FIXME: switch to OutStreamer.EmitAssignment. O << "\t.set\t"; PrintLabelName("set", SetCounter, Flavor); O << ","; |