diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-26 05:58:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-26 05:58:28 +0000 |
commit | beeb93e6ba48af2661eabc4872d8b159fb43e5db (patch) | |
tree | e63ff6ede38987fd5319fe7214f6d9fee5c9eefd /lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | 13e97a29d9dfa5602f93a8c546f112c5d029e8f7 (diff) |
add a new MachineJumpTableInfo::getJTISymbol method,
use it to implement the default TargetLowering::getPICJumpTableRelocBaseExpr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index c1b45c3917..35a77db43d 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -527,6 +527,8 @@ void AsmPrinter::EmitJumpTableInfo(MachineFunction &MF) { // the assembler and linker the extents of the jump table object. The // second label is actually referenced by the code. if (JTInDiffSection && MAI->getLinkerPrivateGlobalPrefix()[0]) + // FIXME: This doesn't have to have any specific name, just any randomly + // named and numbered 'l' label would work. Simplify GetJTISymbol. OutStreamer.EmitLabel(GetJTISymbol(i, true)); OutStreamer.EmitLabel(GetJTISymbol(i)); @@ -1389,12 +1391,7 @@ MCSymbol *AsmPrinter::GetCPISymbol(unsigned CPID) const { /// GetJTISymbol - Return the symbol for the specified jump table entry. MCSymbol *AsmPrinter::GetJTISymbol(unsigned JTID, bool isLinkerPrivate) const { - const char *Prefix = isLinkerPrivate ? MAI->getLinkerPrivateGlobalPrefix() : - MAI->getPrivateGlobalPrefix(); - SmallString<60> Name; - raw_svector_ostream(Name) << Prefix << "JTI" << getFunctionNumber() << '_' - << JTID; - return OutContext.GetOrCreateSymbol(Name.str()); + return MF->getJumpTableInfo()->getJTISymbol(JTID, OutContext,isLinkerPrivate); } /// GetJTSetSymbol - Return the symbol for the specified jump table .set @@ -1549,12 +1546,13 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const { /// specified MachineBasicBlock for a jumptable entry. void AsmPrinter::printPICJumpTableSetLabel(unsigned uid, const MachineBasicBlock *MBB) const { - if (!MAI->getSetDirective()) - return; - + const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); + const TargetLowering *TLI = TM.getTargetLowering(); O << MAI->getSetDirective() << ' ' << MAI->getPrivateGlobalPrefix() << *GetJTSetSymbol(uid, MBB->getNumber()) << ',' - << *MBB->getSymbol(OutContext) << '-' << *GetJTISymbol(uid) << '\n'; + << *MBB->getSymbol(OutContext) << '-' + << *TLI->getPICJumpTableRelocBaseExpr(MJTI,uid,OutContext) + << '\n'; } void AsmPrinter::printVisibility(MCSymbol *Sym, unsigned Visibility) const { |