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
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index c1b45c3..35a77db 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -527,6 +527,8 @@
     // 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 @@
 
 /// 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 @@
 /// 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 {