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
This commit is contained in:
Chris Lattner 2010-01-26 21:53:08 +00:00
parent 0b68a009f6
commit c618c8aff4
4 changed files with 13 additions and 6 deletions

View File

@ -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));
}
}

View File

@ -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 << ",";

View File

@ -1,5 +1,5 @@
; RUN: llc < %s -mtriple=arm-linux-gnueabi -o %t
; RUN: grep set %t | count 5
; RUN: grep { = } %t | count 5
; RUN: grep globl %t | count 4
; RUN: grep weak %t | count 1

View File

@ -1,5 +1,6 @@
; RUN: llc < %s -mtriple=i686-pc-linux-gnu -asm-verbose=false -o %t
; RUN: grep set %t | count 23
; RUN: grep { = } %t | count 7
; RUN: grep set %t | count 16
; RUN: grep globl %t | count 6
; RUN: grep weak %t | count 1
; RUN: grep hidden %t | count 1