Revert r201622 and r201608.
authorDaniel Jasper <djasper@google.com>
Wed, 19 Feb 2014 12:26:01 +0000 (12:26 +0000)
committerDaniel Jasper <djasper@google.com>
Wed, 19 Feb 2014 12:26:01 +0000 (12:26 +0000)
This causes the LLVMgold plugin to segfault. More information on the
replies to r201608.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201669 91177308-0d34-0410-b5e6-96231b3b80d8

31 files changed:
include/llvm/CodeGen/AsmPrinter.h
include/llvm/CodeGen/TargetLoweringObjectFileImpl.h
include/llvm/IR/Mangler.h
include/llvm/Target/TargetLowering.h
include/llvm/Target/TargetLoweringObjectFile.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
lib/CodeGen/AsmPrinter/Win64Exception.cpp
lib/CodeGen/TargetLoweringBase.cpp
lib/CodeGen/TargetLoweringObjectFileImpl.cpp
lib/ExecutionEngine/MCJIT/MCJIT.cpp
lib/IR/Mangler.cpp
lib/LTO/LTOCodeGenerator.cpp
lib/LTO/LTOModule.cpp
lib/Target/ARM/ARMTargetObjectFile.cpp
lib/Target/ARM/ARMTargetObjectFile.h
lib/Target/PowerPC/PPCMCInstLower.cpp
lib/Target/Sparc/SparcTargetObjectFile.cpp
lib/Target/Sparc/SparcTargetObjectFile.h
lib/Target/TargetLoweringObjectFile.cpp
lib/Target/X86/X86MCInstLower.cpp
lib/Target/X86/X86TargetObjectFile.cpp
lib/Target/X86/X86TargetObjectFile.h
lib/Target/XCore/XCoreTargetObjectFile.cpp
test/CodeGen/PowerPC/private.ll
test/CodeGen/X86/2009-11-16-UnfoldMemOpBug.ll
test/CodeGen/X86/global-sections.ll
test/CodeGen/X86/osx-private-labels.ll [deleted file]
test/CodeGen/X86/pr10420.ll
test/CodeGen/X86/private-2.ll

index 8a46d331711b9660737883c5ea6742470591bfcb..79c7fec3ce433856571330073713684749c077e3 100644 (file)
@@ -161,9 +161,6 @@ namespace llvm {
     /// getCurrentSection() - Return the current section we are emitting to.
     const MCSection *getCurrentSection() const;
 
-    void getNameWithPrefix(SmallVectorImpl<char> &Name,
-                           const GlobalValue *GV) const;
-
     MCSymbol *getSymbol(const GlobalValue *GV) const;
 
     //===------------------------------------------------------------------===//
index d329ddd9a7410aa31c3fffe7db54f9504b02c56d..a2179fb49079958b5491dc03930c61b1211144a0 100644 (file)
@@ -57,15 +57,14 @@ public:
 
   /// Return an MCExpr to use for a reference to the specified type info global
   /// variable from exception handling information.
-  const MCExpr *
-  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
-                          Mangler &Mang, const TargetMachine &TM,
-                          MachineModuleInfo *MMI, MCStreamer &Streamer) const
+  const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
+                                        unsigned Encoding, Mangler &Mang,
+                                        MachineModuleInfo *MMI,
+                                        MCStreamer &Streamer) const
       LLVM_OVERRIDE;
 
   // The symbol that gets passed to .cfi_personality.
   MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
-                                    const TargetMachine &TM,
                                     MachineModuleInfo *MMI) const LLVM_OVERRIDE;
 
   void InitializeELF(bool UseInitArray_);
@@ -91,9 +90,6 @@ public:
                        Mangler &Mang, const TargetMachine &TM) const
       LLVM_OVERRIDE;
 
-  bool isSectionAtomizableBySymbols(const MCSection &Section) const
-      LLVM_OVERRIDE;
-
   const MCSection *SelectSectionForGlobal(const GlobalValue *GV,
                                           SectionKind Kind, Mangler &Mang,
                                           const TargetMachine &TM) const
@@ -109,19 +105,18 @@ public:
   /// This hook allows targets to selectively decide not to emit the
   /// UsedDirective for some symbols in llvm.used.
   /// FIXME: REMOVE this (rdar://7071300)
-  bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang,
-                                  TargetMachine &TM) const LLVM_OVERRIDE;
+  bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang) const
+      LLVM_OVERRIDE;
 
   /// The mach-o version of this method defaults to returning a stub reference.
-  const MCExpr *
-  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
-                          Mangler &Mang, const TargetMachine &TM,
-                          MachineModuleInfo *MMI, MCStreamer &Streamer) const
+  const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
+                                        unsigned Encoding, Mangler &Mang,
+                                        MachineModuleInfo *MMI,
+                                        MCStreamer &Streamer) const
       LLVM_OVERRIDE;
 
   // The symbol that gets passed to .cfi_personality.
   MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
-                                    const TargetMachine &TM,
                                     MachineModuleInfo *MMI) const LLVM_OVERRIDE;
 };
 
index c1ba5858a612e3ecf8beefd190c403d537190fa5..07f4feda7e89e37a19e5db920e3596e0fbdcf634 100644 (file)
@@ -51,10 +51,9 @@ public:
   /// Print the appropriate prefix and the specified global variable's name.
   /// If the global variable doesn't have a name, this fills in a unique name
   /// for the global.
-  void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
-                         bool CannotUsePrivateLabel) const;
-  void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
-                         bool CannotUsePrivateLabel) const;
+  void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV) const;
+  void getNameWithPrefix(SmallVectorImpl<char> &OutName,
+                         const GlobalValue *GV) const;
 
   /// Print the appropriate prefix and the specified name as the global variable
   /// name. GVName must not be empty.
index 0b3428ed7a6a791f0a83a43e39cfb3fe4df2ded5..db4dcb0d1f198c238e905afd8f871cf95e295c1c 100644 (file)
@@ -48,10 +48,8 @@ namespace llvm {
   class MachineFunction;
   class MachineInstr;
   class MachineJumpTableInfo;
-  class Mangler;
   class MCContext;
   class MCExpr;
-  class MCSymbol;
   template<typename T> class SmallVectorImpl;
   class DataLayout;
   class TargetRegisterClass;
@@ -1345,10 +1343,6 @@ public:
     return LibcallCallingConvs[Call];
   }
 
-  void getNameWithPrefix(SmallVectorImpl<char> &Name, const GlobalValue *GV,
-                         Mangler &Mang, bool MayAlwaysUsePrivate = false) const;
-  MCSymbol *getSymbol(const GlobalValue *GV, Mangler &Mang) const;
-
 private:
   const TargetMachine &TM;
   const DataLayout *DL;
index 2d9e8d3a2df8802eead5858db0753ff120d5ef59..628c010afc39abcb2bbacc1365365e5e03f9f113 100644 (file)
@@ -71,8 +71,8 @@ public:
   /// This hook allows targets to selectively decide not to emit the
   /// UsedDirective for some symbols in llvm.used.
   /// FIXME: REMOVE this (rdar://7071300)
-  virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang,
-                                          TargetMachine &TM) const {
+  virtual bool shouldEmitUsedDirectiveFor(const GlobalValue *GV,
+                                          Mangler &Mang) const {
     return GV != 0;
   }
 
@@ -117,22 +117,25 @@ public:
 
   /// Return an MCExpr to use for a reference to the specified global variable
   /// from exception handling information.
-  virtual const MCExpr *
-  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
-                          Mangler &Mang, const TargetMachine &TM,
-                          MachineModuleInfo *MMI, MCStreamer &Streamer) const;
+  virtual const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
+                                                unsigned Encoding,
+                                                Mangler &Mang,
+                                                MachineModuleInfo *MMI,
+                                                MCStreamer &Streamer) const;
+
+  /// Return the MCSymbol for the specified global value. This symbol is the
+  /// main label that is the address of the global
+  MCSymbol *getSymbol(const GlobalValue *GV, Mangler &M) const;
 
   /// Return the MCSymbol for a private symbol with global value name as its
   /// base, with the specified suffix.
   MCSymbol *getSymbolWithGlobalValueBase(const GlobalValue *GV,
-                                         StringRef Suffix, Mangler &Mang,
-                                         const TargetMachine &TM) const;
+                                         StringRef Suffix, Mangler &M) const;
 
   // The symbol that gets passed to .cfi_personality.
-  virtual MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV,
-                                            Mangler &Mang,
-                                            const TargetMachine &TM,
-                                            MachineModuleInfo *MMI) const;
+  virtual MCSymbol *
+  getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
+                          MachineModuleInfo *MMI) const;
 
   const MCExpr *
   getTTypeReference(const MCSymbolRefExpr *Sym, unsigned Encoding,
@@ -154,17 +157,10 @@ public:
   virtual const MCExpr *getDebugThreadLocalSymbol(const MCSymbol *Sym) const;
 
   virtual const MCExpr *
-  getExecutableRelativeSymbol(const ConstantExpr *CE, Mangler &Mang,
-                              const TargetMachine &TM) const {
+  getExecutableRelativeSymbol(const ConstantExpr *CE, Mangler &Mang) const {
     return 0;
   }
 
-  /// \brief True if the section is atomized using the symbols in it.
-  /// This is false if the section is not atomized at all (most ELF sections) or
-  /// if it is atomized based on its contents (MachO' __TEXT,__cstring for
-  /// example).
-  virtual bool isSectionAtomizableBySymbols(const MCSection &Section) const;
-
 protected:
   virtual const MCSection *
   SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
index 6c4cddc3f6ed3f89c975d67e7d7a8b2199df00bb..63b4bb4296c7b5d5b2f8d47b7420ad37c6d39bb2 100644 (file)
@@ -311,13 +311,8 @@ void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {
   llvm_unreachable("Unknown linkage type!");
 }
 
-void AsmPrinter::getNameWithPrefix(SmallVectorImpl<char> &Name,
-                                   const GlobalValue *GV) const {
-  TM.getTargetLowering()->getNameWithPrefix(Name, GV, *Mang);
-}
-
 MCSymbol *AsmPrinter::getSymbol(const GlobalValue *GV) const {
-  return TM.getTargetLowering()->getSymbol(GV, *Mang);
+  return getObjFileLowering().getSymbol(GV, *Mang);
 }
 
 /// EmitGlobalVariable - Emit the specified global variable to the .s file.
@@ -1374,7 +1369,7 @@ void AsmPrinter::EmitLLVMUsedList(const ConstantArray *InitList) {
   for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
     const GlobalValue *GV =
       dyn_cast<GlobalValue>(InitList->getOperand(i)->stripPointerCasts());
-    if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, *Mang, TM))
+    if (GV && getObjFileLowering().shouldEmitUsedDirectiveFor(GV, *Mang))
       OutStreamer.EmitSymbolAttribute(getSymbol(GV), MCSA_NoDeadStrip);
   }
 }
@@ -1579,8 +1574,7 @@ static const MCExpr *lowerConstant(const Constant *CV, AsmPrinter &AP) {
   }
 
   if (const MCExpr *RelocExpr =
-          AP.getObjFileLowering().getExecutableRelativeSymbol(CE, *AP.Mang,
-                                                              AP.TM))
+          AP.getObjFileLowering().getExecutableRelativeSymbol(CE, *AP.Mang))
     return RelocExpr;
 
   switch (CE->getOpcode()) {
@@ -2109,8 +2103,7 @@ MCSymbol *AsmPrinter::GetJTSetSymbol(unsigned UID, unsigned MBBID) const {
 
 MCSymbol *AsmPrinter::getSymbolWithGlobalValueBase(const GlobalValue *GV,
                                                    StringRef Suffix) const {
-  return getObjFileLowering().getSymbolWithGlobalValueBase(GV, Suffix, *Mang,
-                                                           TM);
+  return getObjFileLowering().getSymbolWithGlobalValueBase(GV, Suffix, *Mang);
 }
 
 /// GetExternalSymbolSymbol - Return the MCSymbol for the specified
index 5f23e12eac8231520b0654668917b857f965f891..94198c4af1780fc631897ade119edf3ea58d7e3a 100644 (file)
@@ -143,7 +143,7 @@ void AsmPrinter::EmitTTypeReference(const GlobalValue *GV,
     const TargetLoweringObjectFile &TLOF = getObjFileLowering();
 
     const MCExpr *Exp =
-        TLOF.getTTypeGlobalReference(GV, Encoding, *Mang, TM, MMI, OutStreamer);
+        TLOF.getTTypeGlobalReference(GV, Encoding, *Mang, MMI, OutStreamer);
     OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding));
   } else
     OutStreamer.EmitIntValue(0, GetSizeOfEncodedValue(Encoding));
index 30312ac2e281c0113eed6f5c271b5af97626688b..ed51f50c40ef5a1b7e1daa630f03c9ec441927b1 100644 (file)
@@ -119,8 +119,7 @@ void DwarfCFIException::beginFunction(const MachineFunction *MF) {
   if (!shouldEmitPersonality)
     return;
 
-  const MCSymbol *Sym =
-      TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, Asm->TM, MMI);
+  const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, MMI);
   Asm->OutStreamer.EmitCFIPersonality(Sym, PerEncoding);
 
   Asm->OutStreamer.EmitDebugLabel
index 17d8bff6092d7baab1588090b4b00ae192fc169c..eda444bd6922d5735ed56ec0716f6f5e49b40ff3 100644 (file)
@@ -101,8 +101,7 @@ void Win64Exception::endFunction(const MachineFunction *) {
   if (shouldEmitPersonality) {
     const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
     const Function *Per = MMI->getPersonalities()[MMI->getPersonalityIndex()];
-    const MCSymbol *Sym =
-        TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, Asm->TM, MMI);
+    const MCSymbol *Sym = TLOF.getCFIPersonalitySymbol(Per, *Asm->Mang, MMI);
 
     Asm->OutStreamer.PushSection();
     Asm->OutStreamer.EmitWin64EHHandlerData();
index d3c42be5e6c951899e609db6af5ff8c931a35025..bdcb7216a56fb6e49fa07b2e930677c7ac4fa2a1 100644 (file)
@@ -24,9 +24,7 @@
 #include "llvm/IR/DataLayout.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/GlobalVariable.h"
-#include "llvm/IR/Mangler.h"
 #include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ErrorHandling.h"
@@ -1428,30 +1426,3 @@ bool TargetLoweringBase::isLegalAddressingMode(const AddrMode &AM,
 
   return true;
 }
-
-void TargetLoweringBase::getNameWithPrefix(SmallVectorImpl<char> &Name,
-                                           const GlobalValue *GV,
-                                           Mangler &Mang,
-                                           bool MayAlwaysUsePrivate) const {
-  if (MayAlwaysUsePrivate || !GV->hasPrivateLinkage()) {
-    // Simple case: If GV is not private, it is not important to find out if
-    // private labels are legal in this case or not.
-    Mang.getNameWithPrefix(Name, GV, false);
-    return;
-  }
-  SectionKind GVKind =
-    TargetLoweringObjectFile::getKindForGlobal(GV, getTargetMachine());
-  const TargetLoweringObjectFile &TLOF = getObjFileLowering();
-  const MCSection *TheSection =
-    TLOF.SectionForGlobal(GV, GVKind, Mang, getTargetMachine());
-  bool CannotUsePrivateLabel = TLOF.isSectionAtomizableBySymbols(*TheSection);
-  Mang.getNameWithPrefix(Name, GV, CannotUsePrivateLabel);
-}
-
-MCSymbol *TargetLoweringBase::getSymbol(const GlobalValue *GV,
-                                        Mangler &Mang) const {
-  SmallString<60> NameStr;
-  getNameWithPrefix(NameStr, GV, Mang);
-  const TargetLoweringObjectFile &TLOF = getObjFileLowering();
-  return TLOF.getContext().GetOrCreateSymbol(NameStr.str());
-}
index bd54a871ca3cedf0d38eff3792c4dc6e4f353dd0..127b2aa324d30dac116129ae87cca798a9f28d21 100644 (file)
@@ -36,7 +36,6 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetLowering.h"
 using namespace llvm;
 using namespace dwarf;
 
@@ -44,18 +43,19 @@ using namespace dwarf;
 //                                  ELF
 //===----------------------------------------------------------------------===//
 
-MCSymbol *TargetLoweringObjectFileELF::getCFIPersonalitySymbol(
-    const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
-    MachineModuleInfo *MMI) const {
+MCSymbol *
+TargetLoweringObjectFileELF::getCFIPersonalitySymbol(const GlobalValue *GV,
+                                                     Mangler &Mang,
+                                                MachineModuleInfo *MMI) const {
   unsigned Encoding = getPersonalityEncoding();
   switch (Encoding & 0x70) {
   default:
     report_fatal_error("We do not support this DWARF encoding yet!");
   case dwarf::DW_EH_PE_absptr:
-    return TM.getTargetLowering()->getSymbol(GV, Mang);
+    return getSymbol(GV, Mang);
   case dwarf::DW_EH_PE_pcrel: {
     return getContext().GetOrCreateSymbol(StringRef("DW.ref.") +
-                        TM.getTargetLowering()->getSymbol(GV, Mang)->getName());
+                                          getSymbol(GV, Mang)->getName());
   }
   }
 }
@@ -89,19 +89,18 @@ void TargetLoweringObjectFileELF::emitPersonalityValue(MCStreamer &Streamer,
 
 const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference(
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
-    const TargetMachine &TM, MachineModuleInfo *MMI,
-    MCStreamer &Streamer) const {
+    MachineModuleInfo *MMI, MCStreamer &Streamer) const {
 
   if (Encoding & dwarf::DW_EH_PE_indirect) {
     MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
 
-    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang, TM);
+    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang);
 
     // Add information about the stub reference to ELFMMI so that the stub
     // gets emitted by the asmprinter.
     MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
     if (StubSym.getPointer() == 0) {
-      MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
+      MCSymbol *Sym = getSymbol(GV, Mang);
       StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
     }
 
@@ -110,8 +109,8 @@ const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference(
                         Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
   }
 
-  return TargetLoweringObjectFile::
-    getTTypeGlobalReference(GV, Encoding, Mang, TM, MMI, Streamer);
+  return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, Mang,
+                                                           MMI, Streamer);
 }
 
 static SectionKind
@@ -196,9 +195,10 @@ getELFSectionFlags(SectionKind K) {
   return Flags;
 }
 
-const MCSection *TargetLoweringObjectFileELF::getExplicitSectionGlobal(
-    const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
-    const TargetMachine &TM) const {
+
+const MCSection *TargetLoweringObjectFileELF::
+getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+                         Mangler &Mang, const TargetMachine &TM) const {
   StringRef SectionName = GV->getSection();
 
   // Infer section flags from the section name if we can.
@@ -248,12 +248,12 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
     Prefix = getSectionPrefixForGlobal(Kind);
 
     SmallString<128> Name(Prefix, Prefix+strlen(Prefix));
-    TM.getTargetLowering()->getNameWithPrefix(Name, GV, Mang, true);
-
+    MCSymbol *Sym = getSymbol(GV, Mang);
+    Name.append(Sym->getName().begin(), Sym->getName().end());
     StringRef Group = "";
     unsigned Flags = getELFSectionFlags(Kind);
     if (GV->isWeakForLinker()) {
-      Group = Name.substr(strlen(Prefix));
+      Group = Sym->getName();
       Flags |= ELF::SHF_GROUP;
     }
 
@@ -487,9 +487,9 @@ emitModuleFlags(MCStreamer &Streamer,
   Streamer.AddBlankLine();
 }
 
-const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
-    const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
-    const TargetMachine &TM) const {
+const MCSection *TargetLoweringObjectFileMachO::
+getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+                         Mangler &Mang, const TargetMachine &TM) const {
   // Parse the section specifier and create it if valid.
   StringRef Segment, Section;
   unsigned TAA = 0, StubSize = 0;
@@ -526,41 +526,6 @@ const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal(
   return S;
 }
 
-bool TargetLoweringObjectFileMachO::isSectionAtomizableBySymbols(
-    const MCSection &Section) const {
-    const MCSectionMachO &SMO = static_cast<const MCSectionMachO&>(Section);
-
-    // Sections holding 1 byte strings are atomized based on the data
-    // they contain.
-    // Sections holding 2 byte strings require symbols in order to be
-    // atomized.
-    // There is no dedicated section for 4 byte strings.
-    if (SMO.getKind().isMergeable1ByteCString())
-      return false;
-
-    if (SMO.getSegmentName() == "__DATA" &&
-        SMO.getSectionName() == "__cfstring")
-      return false;
-
-    switch (SMO.getType()) {
-    default:
-      return true;
-
-      // These sections are atomized at the element boundaries without using
-      // symbols.
-    case MCSectionMachO::S_4BYTE_LITERALS:
-    case MCSectionMachO::S_8BYTE_LITERALS:
-    case MCSectionMachO::S_16BYTE_LITERALS:
-    case MCSectionMachO::S_LITERAL_POINTERS:
-    case MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS:
-    case MCSectionMachO::S_LAZY_SYMBOL_POINTERS:
-    case MCSectionMachO::S_MOD_INIT_FUNC_POINTERS:
-    case MCSectionMachO::S_MOD_TERM_FUNC_POINTERS:
-    case MCSectionMachO::S_INTERPOSING:
-      return false;
-    }
-}
-
 const MCSection *TargetLoweringObjectFileMachO::
 SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
                        Mangler &Mang, const TargetMachine &TM) const {
@@ -641,17 +606,21 @@ TargetLoweringObjectFileMachO::getSectionForConstant(SectionKind Kind) const {
   return ReadOnlySection;  // .const
 }
 
-/// This hook allows targets to selectively decide not to emit the UsedDirective
-/// for some symbols in llvm.used.
+/// shouldEmitUsedDirectiveFor - This hook allows targets to selectively decide
+/// not to emit the UsedDirective for some symbols in llvm.used.
 // FIXME: REMOVE this (rdar://7071300)
-bool TargetLoweringObjectFileMachO::shouldEmitUsedDirectiveFor(
-    const GlobalValue *GV, Mangler &Mang, TargetMachine &TM) const {
+bool TargetLoweringObjectFileMachO::
+shouldEmitUsedDirectiveFor(const GlobalValue *GV, Mangler &Mang) const {
+  /// On Darwin, internally linked data beginning with "L" or "l" does not have
+  /// the directive emitted (this occurs in ObjC metadata).
+  if (!GV) return false;
+
   // Check whether the mangled name has the "Private" or "LinkerPrivate" prefix.
   if (GV->hasLocalLinkage() && !isa<Function>(GV)) {
     // FIXME: ObjC metadata is currently emitted as internal symbols that have
     // \1L and \0l prefixes on them.  Fix them to be Private/LinkerPrivate and
     // this horrible hack can go away.
-    MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
+    MCSymbol *Sym = getSymbol(GV, Mang);
     if (Sym->getName()[0] == 'L' || Sym->getName()[0] == 'l')
       return false;
   }
@@ -661,16 +630,14 @@ bool TargetLoweringObjectFileMachO::shouldEmitUsedDirectiveFor(
 
 const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
-    const TargetMachine &TM, MachineModuleInfo *MMI,
-    MCStreamer &Streamer) const {
+    MachineModuleInfo *MMI, MCStreamer &Streamer) const {
   // The mach-o version of this method defaults to returning a stub reference.
 
   if (Encoding & DW_EH_PE_indirect) {
     MachineModuleInfoMachO &MachOMMI =
       MMI->getObjFileInfo<MachineModuleInfoMachO>();
 
-    MCSymbol *SSym =
-        getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang, TM);
+    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang);
 
     // Add information about the stub reference to MachOMMI so that the stub
     // gets emitted by the asmprinter.
@@ -678,7 +645,7 @@ const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
       GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) :
                                   MachOMMI.getGVStubEntry(SSym);
     if (StubSym.getPointer() == 0) {
-      MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
+      MCSymbol *Sym = getSymbol(GV, Mang);
       StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
     }
 
@@ -687,24 +654,24 @@ const MCExpr *TargetLoweringObjectFileMachO::getTTypeGlobalReference(
                         Encoding & ~dwarf::DW_EH_PE_indirect, Streamer);
   }
 
-  return TargetLoweringObjectFile::getTTypeGlobalReference(GV, Encoding, Mang,
-                                                           TM, MMI, Streamer);
+  return TargetLoweringObjectFile::
+    getTTypeGlobalReference(GV, Encoding, Mang, MMI, Streamer);
 }
 
-MCSymbol *TargetLoweringObjectFileMachO::getCFIPersonalitySymbol(
-    const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
-    MachineModuleInfo *MMI) const {
+MCSymbol *TargetLoweringObjectFileMachO::
+getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
+                        MachineModuleInfo *MMI) const {
   // The mach-o version of this method defaults to returning a stub reference.
   MachineModuleInfoMachO &MachOMMI =
     MMI->getObjFileInfo<MachineModuleInfoMachO>();
 
-  MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang, TM);
+  MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr", Mang);
 
   // Add information about the stub reference to MachOMMI so that the stub
   // gets emitted by the asmprinter.
   MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym);
   if (StubSym.getPointer() == 0) {
-    MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
+    MCSymbol *Sym = getSymbol(GV, Mang);
     StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
   }
 
@@ -750,9 +717,9 @@ getCOFFSectionFlags(SectionKind K) {
   return Flags;
 }
 
-const MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
-    const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
-    const TargetMachine &TM) const {
+const MCSection *TargetLoweringObjectFileCOFF::
+getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+                         Mangler &Mang, const TargetMachine &TM) const {
   int Selection = 0;
   unsigned Characteristics = getCOFFSectionFlags(Kind);
   StringRef Name = GV->getSection();
@@ -760,7 +727,7 @@ const MCSection *TargetLoweringObjectFileCOFF::getExplicitSectionGlobal(
   if (GV->isWeakForLinker()) {
     Selection = COFF::IMAGE_COMDAT_SELECT_ANY;
     Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
-    MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
+    MCSymbol *Sym = getSymbol(GV, Mang);
     COMDATSymName = Sym->getName();
   }
   return getContext().getCOFFSection(Name,
@@ -794,7 +761,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
     unsigned Characteristics = getCOFFSectionFlags(Kind);
 
     Characteristics |= COFF::IMAGE_SCN_LNK_COMDAT;
-    MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
+    MCSymbol *Sym = getSymbol(GV, Mang);
     return getContext().getCOFFSection(Name, Characteristics,
                                        Kind, Sym->getName(),
                                        COFF::IMAGE_COMDAT_SELECT_ANY);
index 4d5723a7a1369022c049f9e638d07b37caf326f6..4eaeb7a1d5c0aedabcecd5559c5ebc279640ae07 100644 (file)
@@ -27,7 +27,6 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/MutexGuard.h"
-#include "llvm/Target/TargetLowering.h"
 
 using namespace llvm;
 
@@ -372,7 +371,7 @@ void *MCJIT::getPointerToFunction(Function *F) {
   // load address of the symbol, not the local address.
   Mangler Mang(TM->getDataLayout());
   SmallString<128> Name;
-  TM->getTargetLowering()->getNameWithPrefix(Name, F, Mang);
+  Mang.getNameWithPrefix(Name, F);
   return (void*)Dyld.getSymbolLoadAddress(Name);
 }
 
index 4ee2cd2c9358b682ec95212282ad1dc55e1a1732..9c18e6f3001fddd3e5faefb942d3261e00309b83 100644 (file)
@@ -76,18 +76,12 @@ static void AddFastCallStdCallSuffix(raw_ostream &OS, const Function *F,
   OS << '@' << ArgWords;
 }
 
-void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
-                                bool CannotUsePrivateLabel) const {
+void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV) const {
   ManglerPrefixTy PrefixTy = Mangler::Default;
-  if (GV->hasPrivateLinkage()) {
-    if (CannotUsePrivateLabel)
-      PrefixTy = Mangler::LinkerPrivate;
-    else
-      PrefixTy = Mangler::Private;
-  } else if (GV->hasLinkerPrivateLinkage() ||
-             GV->hasLinkerPrivateWeakLinkage()) {
+  if (GV->hasPrivateLinkage())
+    PrefixTy = Mangler::Private;
+  else if (GV->hasLinkerPrivateLinkage() || GV->hasLinkerPrivateWeakLinkage())
     PrefixTy = Mangler::LinkerPrivate;
-  }
 
   if (!GV->hasName()) {
     // Get the ID for the global, assigning a new one if we haven't got one
@@ -140,8 +134,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
 }
 
 void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
-                                const GlobalValue *GV,
-                                bool CannotUsePrivateLabel) const {
+                                const GlobalValue *GV) const {
   raw_svector_ostream OS(OutName);
-  getNameWithPrefix(OS, GV, CannotUsePrivateLabel);
+  getNameWithPrefix(OS, GV);
 }
index 01c8d405b49fc4e17d07286ba8cd12cddb1de7ab..073947055ace16f0b5b96c9257f736f707611f26 100644 (file)
@@ -336,7 +336,7 @@ applyRestriction(GlobalValue &GV,
                  SmallPtrSet<GlobalValue*, 8> &AsmUsed,
                  Mangler &Mangler) {
   SmallString<64> Buffer;
-  TargetMach->getTargetLowering()->getNameWithPrefix(Buffer, &GV, Mangler);
+  Mangler.getNameWithPrefix(Buffer, &GV);
 
   if (GV.isDeclaration())
     return;
index a70c6e2c0a3f3e171fda4fb6afb385297789f73c..909b92e888662000e80be0113f6d15ceb2e5bd4c 100644 (file)
@@ -381,7 +381,7 @@ void LTOModule::addDefinedSymbol(const GlobalValue *def, bool isFunction) {
 
   // string is owned by _defines
   SmallString<64> Buffer;
-  _target->getTargetLowering()->getNameWithPrefix(Buffer, def, _mangler);
+  _mangler.getNameWithPrefix(Buffer, def);
 
   // set alignment part log2() can have rounding errors
   uint32_t align = def->getAlignment();
@@ -517,7 +517,7 @@ LTOModule::addPotentialUndefinedSymbol(const GlobalValue *decl, bool isFunc) {
     return;
 
   SmallString<64> name;
-  _target->getTargetLowering()->getNameWithPrefix(name, decl, _mangler);
+  _mangler.getNameWithPrefix(name, decl);
 
   StringMap<NameAndAttributes>::value_type &entry =
     _undefines.GetOrCreateValue(name);
index 4e81fcdc3abbd873854b4b233c7cec9d5fac881b..f9d71acf116088443de2ea836289c627a29fb152 100644 (file)
@@ -16,7 +16,7 @@
 #include "llvm/MC/MCSectionELF.h"
 #include "llvm/Support/Dwarf.h"
 #include "llvm/Support/ELF.h"
-#include "llvm/Target/TargetLowering.h"
+#include "llvm/Target/TargetMachine.h"
 using namespace llvm;
 using namespace dwarf;
 
@@ -43,12 +43,12 @@ void ARMElfTargetObjectFile::Initialize(MCContext &Ctx,
 
 const MCExpr *ARMElfTargetObjectFile::getTTypeGlobalReference(
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
-    const TargetMachine &TM, MachineModuleInfo *MMI,
-    MCStreamer &Streamer) const {
+    MachineModuleInfo *MMI, MCStreamer &Streamer) const {
   assert(Encoding == DW_EH_PE_absptr && "Can handle absptr encoding only");
 
-  return MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang),
-                                 MCSymbolRefExpr::VK_ARM_TARGET2, getContext());
+  return MCSymbolRefExpr::Create(getSymbol(GV, Mang),
+                                 MCSymbolRefExpr::VK_ARM_TARGET2,
+                                 getContext());
 }
 
 const MCExpr *ARMElfTargetObjectFile::
index aee5836141baff9e3b71306db6275569d0624e1f..c703f2fafa35a62f6bde44739bfff15c66e5dff3 100644 (file)
@@ -28,10 +28,10 @@ public:
 
   void Initialize(MCContext &Ctx, const TargetMachine &TM) LLVM_OVERRIDE;
 
-  const MCExpr *
-  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
-                          Mangler &Mang, const TargetMachine &TM,
-                          MachineModuleInfo *MMI, MCStreamer &Streamer) const
+  const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
+                                        unsigned Encoding, Mangler &Mang,
+                                        MachineModuleInfo *MMI,
+                                        MCStreamer &Streamer) const
       LLVM_OVERRIDE;
 
   /// \brief Describe a TLS variable address within debug info.
index cc40361cfc74ec6717799d01720c0989b8f7ca55..fed254d7990e0b15bb5fd2f6a026343d582a7684 100644 (file)
@@ -25,8 +25,7 @@
 #include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCInst.h"
-#include "llvm/Target/TargetLowering.h"
-#include "llvm/Target/TargetLoweringObjectFile.h"
+#include "llvm/Target/TargetMachine.h"
 using namespace llvm;
 
 static MachineModuleInfoMachO &getMachOMMI(AsmPrinter &AP) {
@@ -35,9 +34,7 @@ static MachineModuleInfoMachO &getMachOMMI(AsmPrinter &AP) {
 
 
 static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){
-  const TargetMachine &TM = AP.TM;
-  Mangler *Mang = AP.Mang;
-  const DataLayout *DL = TM.getDataLayout();
+  const DataLayout *DL = AP.TM.getDataLayout();
   MCContext &Ctx = AP.OutContext;
 
   SmallString<128> Name;
@@ -54,10 +51,10 @@ static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){
 
   if (!MO.isGlobal()) {
     assert(MO.isSymbol() && "Isn't a symbol reference");
-    Mang->getNameWithPrefix(Name, MO.getSymbolName());
+    AP.Mang->getNameWithPrefix(Name, MO.getSymbolName());
   } else {
     const GlobalValue *GV = MO.getGlobal();
-    TM.getTargetLowering()->getNameWithPrefix(Name, GV, *Mang);
+    AP.Mang->getNameWithPrefix(Name, GV);
   }
 
   unsigned OrigLen = Name.size() - PrefixLen;
index b732e18d816e676af5efe4d3190b3d513beaf8a9..11cc41f8c62937a55deb213411c7bc4d696b3b90 100644 (file)
 #include "MCTargetDesc/SparcMCExpr.h"
 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
 #include "llvm/Support/Dwarf.h"
-#include "llvm/Target/TargetLowering.h"
 
 using namespace llvm;
 
 const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
-    const TargetMachine &TM, MachineModuleInfo *MMI,
-    MCStreamer &Streamer) const {
+    MachineModuleInfo *MMI, MCStreamer &Streamer) const {
 
   if (Encoding & dwarf::DW_EH_PE_pcrel) {
     MachineModuleInfoELF &ELFMMI = MMI->getObjFileInfo<MachineModuleInfoELF>();
 
-    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang, TM);
+    MCSymbol *SSym = getSymbolWithGlobalValueBase(GV, ".DW.stub", Mang);
 
     // Add information about the stub reference to ELFMMI so that the stub
     // gets emitted by the asmprinter.
     MachineModuleInfoImpl::StubValueTy &StubSym = ELFMMI.getGVStubEntry(SSym);
     if (StubSym.getPointer() == 0) {
-      MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
+      MCSymbol *Sym = getSymbol(GV, Mang);
       StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage());
     }
 
@@ -39,5 +37,5 @@ const MCExpr *SparcELFTargetObjectFile::getTTypeGlobalReference(
   }
 
   return TargetLoweringObjectFileELF::getTTypeGlobalReference(
-      GV, Encoding, Mang, TM, MMI, Streamer);
+      GV, Encoding, Mang, MMI, Streamer);
 }
index cce4a786903d9d620ae8979ed9728e82509d9137..933d758f76d94f2847a68a906a28f6e07d0fd7b3 100644 (file)
@@ -23,10 +23,10 @@ public:
     TargetLoweringObjectFileELF()
   {}
 
-  const MCExpr *
-  getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
-                          Mangler &Mang, const TargetMachine &TM,
-                          MachineModuleInfo *MMI, MCStreamer &Streamer) const
+  const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
+                                        unsigned Encoding, Mangler &Mang,
+                                        MachineModuleInfo *MMI,
+                                        MCStreamer &Streamer) const
       LLVM_OVERRIDE;
 };
 
index 9fff220d47dfa34805966908222ea39d7215245e..a0218a83df120d570328bb074dbcbebbf71164a9 100644 (file)
@@ -28,7 +28,6 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Target/TargetMachine.h"
-#include "llvm/Target/TargetLowering.h"
 #include "llvm/Target/TargetOptions.h"
 using namespace llvm;
 
@@ -100,22 +99,30 @@ static bool IsNullTerminatedString(const Constant *C) {
   return false;
 }
 
+/// Return the MCSymbol for the specified global value.  This
+/// symbol is the main label that is the address of the global.
+MCSymbol *TargetLoweringObjectFile::getSymbol(const GlobalValue *GV,
+                                              Mangler &M) const {
+  SmallString<60> NameStr;
+  M.getNameWithPrefix(NameStr, GV);
+  return Ctx->GetOrCreateSymbol(NameStr.str());
+}
+
 MCSymbol *TargetLoweringObjectFile::getSymbolWithGlobalValueBase(
-    const GlobalValue *GV, StringRef Suffix, Mangler &Mang,
-    const TargetMachine &TM) const {
+    const GlobalValue *GV, StringRef Suffix, Mangler &M) const {
   assert(!Suffix.empty());
 
   SmallString<60> NameStr;
   NameStr += DL->getPrivateGlobalPrefix();
-  TM.getTargetLowering()->getNameWithPrefix(NameStr, GV, Mang);
+  M.getNameWithPrefix(NameStr, GV);
   NameStr.append(Suffix.begin(), Suffix.end());
   return Ctx->GetOrCreateSymbol(NameStr.str());
 }
 
-MCSymbol *TargetLoweringObjectFile::getCFIPersonalitySymbol(
-    const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
-    MachineModuleInfo *MMI) const {
-  return TM.getTargetLowering()->getSymbol(GV, Mang);
+MCSymbol *TargetLoweringObjectFile::
+getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
+                        MachineModuleInfo *MMI) const {
+  return getSymbol(GV, Mang);
 }
 
 void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
@@ -268,10 +275,6 @@ SectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang,
   return SelectSectionForGlobal(GV, Kind, Mang, TM);
 }
 
-bool TargetLoweringObjectFile::isSectionAtomizableBySymbols(
-    const MCSection &Section) const {
-  return false;
-}
 
 // Lame default implementation. Calculate the section name for global.
 const MCSection *
@@ -309,11 +312,9 @@ TargetLoweringObjectFile::getSectionForConstant(SectionKind Kind) const {
 /// handling information.
 const MCExpr *TargetLoweringObjectFile::getTTypeGlobalReference(
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
-    const TargetMachine &TM, MachineModuleInfo *MMI,
-    MCStreamer &Streamer) const {
+    MachineModuleInfo *MMI, MCStreamer &Streamer) const {
   const MCSymbolRefExpr *Ref =
-    MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GV, Mang),
-                            getContext());
+      MCSymbolRefExpr::Create(getSymbol(GV, Mang), getContext());
 
   return getTTypeReference(Ref, Encoding, Streamer);
 }
index 3dabbd72ede893d66ac7907b3e79ff7d78a997fb..6f88cf1059529fcc7554543477f8fc4f973bb595 100644 (file)
@@ -98,7 +98,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
 
   if (MO.isGlobal()) {
     const GlobalValue *GV = MO.getGlobal();
-    AsmPrinter.getNameWithPrefix(Name, GV);
+    getMang()->getNameWithPrefix(Name, GV);
   } else if (MO.isSymbol()) {
     getMang()->getNameWithPrefix(Name, MO.getSymbolName());
   } else if (MO.isMBB()) {
index 95fccba48ac6442042e9174c940576cdb4f694bd..c5ba3ecd91f095cf3e942f5342684386da816635 100644 (file)
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCSectionELF.h"
 #include "llvm/Support/Dwarf.h"
-#include "llvm/Target/TargetLowering.h"
 
 using namespace llvm;
 using namespace dwarf;
 
 const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference(
     const GlobalValue *GV, unsigned Encoding, Mangler &Mang,
-    const TargetMachine &TM, MachineModuleInfo *MMI,
-    MCStreamer &Streamer) const {
+    MachineModuleInfo *MMI, MCStreamer &Streamer) const {
 
   // On Darwin/X86-64, we can reference dwarf symbols with foo@GOTPCREL+4, which
   // is an indirect pc-relative reference.
   if (Encoding & (DW_EH_PE_indirect | DW_EH_PE_pcrel)) {
-    const MCSymbol *Sym = TM.getTargetLowering()->getSymbol(GV, Mang);
+    const MCSymbol *Sym = getSymbol(GV, Mang);
     const MCExpr *Res =
       MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, getContext());
     const MCExpr *Four = MCConstantExpr::Create(4, getContext());
@@ -35,13 +33,13 @@ const MCExpr *X86_64MachoTargetObjectFile::getTTypeGlobalReference(
   }
 
   return TargetLoweringObjectFileMachO::getTTypeGlobalReference(
-      GV, Encoding, Mang, TM, MMI, Streamer);
+      GV, Encoding, Mang, MMI, Streamer);
 }
 
-MCSymbol *X86_64MachoTargetObjectFile::getCFIPersonalitySymbol(
-    const GlobalValue *GV, Mangler &Mang, const TargetMachine &TM,
-    MachineModuleInfo *MMI) const {
-  return TM.getTargetLowering()->getSymbol(GV, Mang);
+MCSymbol *X86_64MachoTargetObjectFile::
+getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
+                        MachineModuleInfo *MMI) const {
+  return getSymbol(GV, Mang);
 }
 
 void
@@ -56,8 +54,9 @@ X86LinuxTargetObjectFile::getDebugThreadLocalSymbol(
   return MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_DTPOFF, getContext());
 }
 
-const MCExpr *X86WindowsTargetObjectFile::getExecutableRelativeSymbol(
-    const ConstantExpr *CE, Mangler &Mang, const TargetMachine &TM) const {
+const MCExpr *
+X86WindowsTargetObjectFile::getExecutableRelativeSymbol(const ConstantExpr *CE,
+                                                        Mangler &Mang) const {
   // We are looking for the difference of two symbols, need a subtraction
   // operation.
   const SubOperator *Sub = dyn_cast<SubOperator>(CE);
@@ -102,7 +101,6 @@ const MCExpr *X86WindowsTargetObjectFile::getExecutableRelativeSymbol(
   if (GVLHS->isThreadLocal())
     return 0;
 
-  return MCSymbolRefExpr::Create(TM.getTargetLowering()->getSymbol(GVLHS, Mang),
-                                 MCSymbolRefExpr::VK_COFF_IMGREL32,
-                                 getContext());
+  return MCSymbolRefExpr::Create(
+      getSymbol(GVLHS, Mang), MCSymbolRefExpr::VK_COFF_IMGREL32, getContext());
 }
index 22f3e572d9c0e1f3483b93cda9e11da6203adb3d..45739475f8d7ea516b8ab45c303c8d48ce1d6160 100644 (file)
@@ -20,16 +20,15 @@ namespace llvm {
   /// x86-64.
   class X86_64MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
   public:
-    const MCExpr *
-    getTTypeGlobalReference(const GlobalValue *GV, unsigned Encoding,
-                            Mangler &Mang, const TargetMachine &TM,
-                            MachineModuleInfo *MMI, MCStreamer &Streamer) const
+    const MCExpr *getTTypeGlobalReference(const GlobalValue *GV,
+                                          unsigned Encoding, Mangler &Mang,
+                                          MachineModuleInfo *MMI,
+                                          MCStreamer &Streamer) const
         LLVM_OVERRIDE;
 
     // getCFIPersonalitySymbol - The symbol that gets passed to
     // .cfi_personality.
     MCSymbol *getCFIPersonalitySymbol(const GlobalValue *GV, Mangler &Mang,
-                                      const TargetMachine &TM,
                                       MachineModuleInfo *MMI) const
         LLVM_OVERRIDE;
   };
@@ -47,8 +46,7 @@ namespace llvm {
   /// \brief This implementation is used for Windows targets on x86 and x86-64.
   class X86WindowsTargetObjectFile : public TargetLoweringObjectFileCOFF {
     const MCExpr *getExecutableRelativeSymbol(const ConstantExpr *CE,
-                                              Mangler &Mang,
-                                              const TargetMachine &TM) const
+                                              Mangler &Mang) const
         LLVM_OVERRIDE;
   };
 
index ab0f7ad47dcc087ccdf71915c6e0861a942fe926..6584ee2d13a1be8c4184b1830e26620146623e99 100644 (file)
@@ -118,10 +118,9 @@ static unsigned getXCoreSectionFlags(SectionKind K, bool IsCPRel) {
   return Flags;
 }
 
-const MCSection *
-XCoreTargetObjectFile::getExplicitSectionGlobal(const GlobalValue *GV,
-                                                SectionKind Kind, Mangler &Mang,
-                                                const TargetMachine &TM) const {
+const MCSection *XCoreTargetObjectFile::
+getExplicitSectionGlobal(const GlobalValue *GV, SectionKind Kind,
+                         Mangler &Mang, const TargetMachine &TM) const {
   StringRef SectionName = GV->getSection();
   // Infer section flags from the section name if we can.
   bool IsCPRel = SectionName.startswith(".cp.");
index 633fa651037f78c00c750c04065ecceb1aa3466f..e606dd1136b5bc57597c90490704b8db9e30925c 100644 (file)
@@ -7,22 +7,22 @@
 ; RUN: FileCheck --check-prefix=OSX %s
 
 ; LINUX: .Lfoo:
-; OSX: l_foo:
+; OSX: L_foo:
 define private void @foo() nounwind {
         ret void
 }
 
 define i32 @bar() nounwind {
 ; LINUX: bl{{.*}}.Lfoo
-; OSX: bl{{.*}}l_foo
+; OSX: bl{{.*}}L_foo
         call void @foo()
 
 ; LINUX: lis{{.*}}.Lbaz
-; OSX:  lis{{.*}}l_baz
+; OSX:  lis{{.*}}L_baz
        %1 = load i32* @baz, align 4
         ret i32 %1
 }
 
 ; LINUX: .Lbaz:
-; OSX: l_baz:
+; OSX: L_baz:
 @baz = private global i32 4
index b828c27e782664e727ae2ba9acbcabd582779ebc..08a99e3f661827bab42f8c2704d525e332dcd332 100644 (file)
@@ -1,7 +1,7 @@
 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck %s
 ; rdar://7396984
 
-@str = private unnamed_addr constant [28 x i8] c"xxxxxxxxxxxxxxxxxxxxxxxxxxx\00", align 1
+@str = private constant [28 x i8] c"xxxxxxxxxxxxxxxxxxxxxxxxxxx\00", align 1
 
 define void @t(i32 %count) ssp nounwind {
 entry:
index c031821f9a6e3b268df8cc9271924eb289eb016b..eaf7337214b914f3fe95ba682a0ec839b4e8d414 100644 (file)
 ; DARWIN: .zerofill __DATA,__common,_G12,1,3
 ; DARWIN: .globl _G13
 ; DARWIN: .zerofill __DATA,__common,_G13,1,3
-
-@G14 = private unnamed_addr constant [4 x i8] c"foo\00", align 1
-
-; LINUX-SECTIONS:        .type   .LG14,@object           # @G14
-; LINUX-SECTIONS:        .section        .rodata..LG14,"aMS",@progbits,1
-; LINUX-SECTIONS: .LG14:
-; LINUX-SECTIONS:        .asciz  "foo"
-; LINUX-SECTIONS:        .size   .LG14, 4
diff --git a/test/CodeGen/X86/osx-private-labels.ll b/test/CodeGen/X86/osx-private-labels.ll
deleted file mode 100644 (file)
index 349ce7d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
-; Test all the cases where a L label is safe. Removing any entry from
-; TargetLoweringObjectFileMachO::isSectionAtomizableBySymbols should cause
-; this to fail.
-; We also test some noteworthy cases that require an l label.
-
-@private1 = private unnamed_addr constant [4 x i8] c"zed\00"
-; CHECK: .section      __TEXT,__cstring,cstring_literals
-; CHECK-NEXT: L_private1:
-
-@private2 = private unnamed_addr constant [5 x i16] [i16 116, i16 101,
-                                                     i16 115, i16 116, i16 0]
-; CHECK: .section      __TEXT,__ustring
-; CHECK-NEXT: .align   1
-; CHECK-NEXT: l_private2:
-
-; There is no dedicated 4 byte strings on MachO.
-
-%struct.NSConstantString = type { i32*, i32, i8*, i32 }
-@private3 = private constant %struct.NSConstantString { i32* null, i32 1992, i8* null, i32 0 }, section "__DATA,__cfstring"
-; CHECK: .section      __DATA,__cfstring
-; CHECK-NEXT: .align   4
-; CHECK-NEXT: L_private3:
-
-; There is no dedicated 1 or 2 byte constant section on MachO.
-
-@private4 = private unnamed_addr constant i32 42
-; CHECK: .section      __TEXT,__literal4,4byte_literals
-; CHECK-NEXT: .align   2
-; CHECK-NEXT: L_private4:
-
-@private5 = private unnamed_addr constant i64 42
-; CHECK: .section      __TEXT,__literal8,8byte_literals
-; CHECK-NEXT: .align   3
-; CHECK-NEXT: L_private5:
-
-@private6 = private unnamed_addr constant i128 42
-; CHECK: .section      __TEXT,__literal16,16byte_literals
-; CHECK-NEXT: .align   3
-; CHECK-NEXT: L_private6:
-
-%struct._objc_class = type { i8* }
-@private7 = private global %struct._objc_class* null, section "__OBJC,__cls_refs,literal_pointers,no_dead_strip"
-; CHECK: .section      __OBJC,__cls_refs,literal_pointers,no_dead_strip
-; CHECK: .align        3
-; CHECK: L_private7:
-
-@private8 = private global i32* null, section "__DATA,__nl_symbol_ptr,non_lazy_symbol_pointers"
-; CHECK: .section      __DATA,__nl_symbol_ptr,non_lazy_symbol_pointers
-; CHECK-NEXT: .align   3
-; CHECK-NEXT: L_private8:
-
-@private9 = private global i32* null, section "__DATA,__la_symbol_ptr,lazy_symbol_pointers"
-; CHECK: .section      __DATA,__la_symbol_ptr,lazy_symbol_pointers
-; CHECK-NEXT: .align   3
-; CHECK-NEXT: L_private9:
-
-@private10 = private global i32* null, section "__DATA,__mod_init_func,mod_init_funcs"
-; CHECK: .section      __DATA,__mod_init_func,mod_init_funcs
-; CHECK-NEXT: .align   3
-; CHECK-NEXT: L_private10:
-
-@private11 = private global i32* null, section "__DATA,__mod_term_func,mod_term_funcs"
-; CHECK: .section      __DATA,__mod_term_func,mod_term_funcs
-; CHECK-NEXT: .align   3
-; CHECK-NEXT: L_private11:
-
-@private12 = private global i32* null, section "__DATA,__foobar,interposing"
-; CHECK: .section      __DATA,__foobar,interposing
-; CHECK-NEXT: .align   3
-; CHECK-NEXT: L_private12:
index b2f08e873b299d67d956974ebf3fddaa34014a8b..100bb2c9eefa93f898cc026bef8a2fadd44b2927 100644 (file)
@@ -14,7 +14,7 @@ define void @bar() {
        ret void;
 }
 
-; CHECK: l_foo:                                   ## @foo
+; CHECK: L_foo:                                   ## @foo
 ; CHECK-NEXT: Ltmp0:
 
 ; CHECK: _bar:                                   ## @bar
@@ -34,7 +34,7 @@ define void @bar() {
 ; CHECK-NEXT: {{.quad|.long}}   Ltmp[[NUM2]]
 
 
-; OLD: l_foo:                                   ## @foo
+; OLD: L_foo:                                   ## @foo
 ; OLD-NEXT: Ltmp0:
 
 ; OLD: _bar:                                   ## @bar
index cf2d741193746f42fe202df9ecf25d850afa2fac..4413cee23b33e39e153632c97053cadcd5431e9d 100644 (file)
@@ -2,7 +2,7 @@
 ; Quote should be outside of private prefix.
 ; rdar://6855766x
 
-; CHECK: "l__ZZ20-[Example1 whatever]E4C.91"
+; CHECK: L__ZZ20
 
        %struct.A = type { i32*, i32 }
 @"_ZZ20-[Example1 whatever]E4C.91" = private constant %struct.A { i32* null, i32 1 }           ; <%struct.A*> [#uses=1]