change FnStubs from being a StringMap<std::string> to being a much
more efficient SmallPtrSet<MCSymbol*>.  This eliminates string
craziness and fixes CodeGen/X86/darwin-quote.ll with the new asmprinter.

Codegen is producing stubs in a nondeterminstic order, but it was doing
this before anyway.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81511 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
index 1cccfa9..2aced08 100644
--- a/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
+++ b/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
@@ -78,10 +78,12 @@
     Name += "$non_lazy_ptr";
     HiddenGVStubs[Name.str()] = StringRef(Name.data(), Name.size()-13);
     break;
-  case X86II::MO_DARWIN_STUB:
+  case X86II::MO_DARWIN_STUB: {
     Name += "$stub";
-    FnStubs[Name.str()] = StringRef(Name.data(), Name.size()-5);
-    break;
+    MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name.str());
+    FnStubs.insert(Sym);
+    return Sym;
+  }
   // FIXME: These probably should be a modifier on the symbol or something??
   case X86II::MO_TLSGD:     Name += "@TLSGD";     break;
   case X86II::MO_GOTTPOFF:  Name += "@GOTTPOFF";  break;
@@ -114,12 +116,13 @@
     Name.insert(Name.begin(), Prefix, Prefix+strlen(Prefix));
     break;
   }
-  case X86II::MO_DARWIN_STUB:
-    // Insert: FnStub["_foo$stub"] = "_foo";
+  case X86II::MO_DARWIN_STUB: {
     Name += "$stub";
-    FnStubs[Name.str()] = StringRef(Name.data(), Name.size()-5);
-    break;
-    // FIXME: These probably should be a modifier on the symbol or something??
+    MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name.str());
+    FnStubs.insert(Sym);
+    return Sym;
+  }
+  // FIXME: These probably should be a modifier on the symbol or something??
   case X86II::MO_TLSGD:     Name += "@TLSGD";     break;
   case X86II::MO_GOTTPOFF:  Name += "@GOTTPOFF";  break;
   case X86II::MO_INDNTPOFF: Name += "@INDNTPOFF"; break;