[llvm] r240405 - Simplify the Mangler interface now that DataLayout is mandatory.

Josh Klontz josh.klontz at gmail.com
Sun Jul 12 17:47:42 PDT 2015


Rafael,

FWIW this commit appears to change the name mangling behavior for a Module
with the default DataLayout, by removing the leading underscore in the
symbol name, when constructing an object file through
TargetMachine::addPassesToEmitFile.

I noticed this because this commit exposed a bug in my own code where
I hadn't explicitly set the DataLayout. Just wanted to give a heads up in
case this wasn't intended!

v/r,
Josh

On Tue, Jun 23, 2015 at 9:59 AM, Rafael Espindola <
rafael.espindola at gmail.com> wrote:

> Author: rafael
> Date: Tue Jun 23 08:59:29 2015
> New Revision: 240405
>
> URL: http://llvm.org/viewvc/llvm-project?rev=240405&view=rev
> Log:
> Simplify the Mangler interface now that DataLayout is mandatory.
>
> We only need to pass in a DataLayout when mangling a raw string, not when
> constructing the mangler.
>
> Modified:
>     llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp
>     llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp
>     llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
>     llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp
>     llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
>     llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
>     llvm/trunk/include/llvm/IR/Mangler.h
>     llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
>     llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
>     llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
>     llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
>     llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
>     llvm/trunk/lib/IR/Mangler.cpp
>     llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
>     llvm/trunk/lib/Object/IRObjectFile.cpp
>     llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
>     llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp
>     llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
>     llvm/trunk/tools/lli/OrcLazyJIT.h
>
> Modified: llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp (original)
> +++ llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp Tue Jun 23
> 08:59:29 2015
> @@ -1168,7 +1168,6 @@ public:
>
>    KaleidoscopeJIT(SessionContext &Session)
>      : Session(Session),
> -      Mang(Session.getTarget().getDataLayout()),
>        CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
>        LazyEmitLayer(CompileLayer),
>        CompileCallbacks(LazyEmitLayer, CCMgrMemMgr,
> Session.getLLVMContext(),
> @@ -1179,7 +1178,8 @@ public:
>      std::string MangledName;
>      {
>        raw_string_ostream MangledNameStream(MangledName);
> -      Mang.getNameWithPrefix(MangledNameStream, Name);
> +      Mangler::getNameWithPrefix(MangledNameStream, Name,
> +                                 *Session.getTarget().getDataLayout());
>      }
>      return MangledName;
>    }
> @@ -1306,7 +1306,6 @@ private:
>    }
>
>    SessionContext &Session;
> -  Mangler Mang;
>    SectionMemoryManager CCMgrMemMgr;
>    ObjLayerT ObjectLayer;
>    CompileLayerT CompileLayer;
>
> Modified: llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp (original)
> +++ llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp Tue Jun 23
> 08:59:29 2015
> @@ -1160,14 +1160,14 @@ public:
>    typedef CompileLayerT::ModuleSetHandleT ModuleHandleT;
>
>    KaleidoscopeJIT(SessionContext &Session)
> -    : Mang(Session.getTarget().getDataLayout()),
> -      CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())) {}
> +      : DL(*Session.getTarget().getDataLayout()),
> +        CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())) {}
>
>    std::string mangle(const std::string &Name) {
>      std::string MangledName;
>      {
>        raw_string_ostream MangledNameStream(MangledName);
> -      Mang.getNameWithPrefix(MangledNameStream, Name);
> +      Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
>      }
>      return MangledName;
>    }
> @@ -1201,8 +1201,7 @@ public:
>    }
>
>  private:
> -
> -  Mangler Mang;
> +  const DataLayout &DL;
>    ObjLayerT ObjectLayer;
>    CompileLayerT CompileLayer;
>  };
>
> Modified: llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp (original)
> +++ llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp Tue Jun 23
> 08:59:29 2015
> @@ -1162,15 +1162,15 @@ public:
>    typedef LazyEmitLayerT::ModuleSetHandleT ModuleHandleT;
>
>    KaleidoscopeJIT(SessionContext &Session)
> -    : Mang(Session.getTarget().getDataLayout()),
> -      CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
> -      LazyEmitLayer(CompileLayer) {}
> +      : DL(*Session.getTarget().getDataLayout()),
> +        CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
> +        LazyEmitLayer(CompileLayer) {}
>
>    std::string mangle(const std::string &Name) {
>      std::string MangledName;
>      {
>        raw_string_ostream MangledNameStream(MangledName);
> -      Mang.getNameWithPrefix(MangledNameStream, Name);
> +      Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
>      }
>      return MangledName;
>    }
> @@ -1204,8 +1204,7 @@ public:
>    }
>
>  private:
> -
> -  Mangler Mang;
> +  const DataLayout &DL;
>    ObjLayerT ObjectLayer;
>    CompileLayerT CompileLayer;
>    LazyEmitLayerT LazyEmitLayer;
>
> Modified: llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp (original)
> +++ llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp Tue Jun 23
> 08:59:29 2015
> @@ -1162,7 +1162,6 @@ public:
>
>    KaleidoscopeJIT(SessionContext &Session)
>      : Session(Session),
> -      Mang(Session.getTarget().getDataLayout()),
>        CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
>        LazyEmitLayer(CompileLayer) {}
>
> @@ -1170,7 +1169,8 @@ public:
>      std::string MangledName;
>      {
>        raw_string_ostream MangledNameStream(MangledName);
> -      Mang.getNameWithPrefix(MangledNameStream, Name);
> +      Mangler::getNameWithPrefix(MangledNameStream, Name,
> +                                 *Session.getTarget().getDataLayout());
>      }
>      return MangledName;
>    }
> @@ -1236,7 +1236,6 @@ private:
>    }
>
>    SessionContext &Session;
> -  Mangler Mang;
>    ObjLayerT ObjectLayer;
>    CompileLayerT CompileLayer;
>    LazyEmitLayerT LazyEmitLayer;
>
> Modified:
> llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h
> (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h Tue
> Jun 23 08:59:29 2015
> @@ -241,11 +241,10 @@ private:
>    }
>
>    static std::string Mangle(StringRef Name, const DataLayout &DL) {
> -    Mangler M(&DL);
>      std::string MangledName;
>      {
>        raw_string_ostream MangledNameStream(MangledName);
> -      M.getNameWithPrefix(MangledNameStream, Name);
> +      Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
>      }
>      return MangledName;
>    }
>
> Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h
> (original)
> +++ llvm/trunk/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h Tue
> Jun 23 08:59:29 2015
> @@ -193,7 +193,7 @@ private:
>        auto Symbols = llvm::make_unique<StringMap<const GlobalValue*>>();
>
>        for (const auto &M : Ms) {
> -        Mangler Mang(&M->getDataLayout());
> +        Mangler Mang;
>
>          for (const auto &V : M->globals())
>            if (auto GV = addGlobalValue(*Symbols, V, Mang, SearchName,
>
> Modified: llvm/trunk/include/llvm/IR/Mangler.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Mangler.h?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/IR/Mangler.h (original)
> +++ llvm/trunk/include/llvm/IR/Mangler.h Tue Jun 23 08:59:29 2015
> @@ -33,8 +33,6 @@ public:
>    };
>
>  private:
> -  const DataLayout *DL;
> -
>    /// We need to give global values the same name every time they are
> mangled.
>    /// This keeps track of the number we give to anonymous ones.
>    mutable DenseMap<const GlobalValue*, unsigned> AnonGlobalIDs;
> @@ -43,15 +41,11 @@ private:
>    mutable unsigned NextAnonGlobalID;
>
>  public:
> -  Mangler(const DataLayout *DL) : DL(DL), NextAnonGlobalID(1) {}
> +  Mangler() : NextAnonGlobalID(1) {}
>
>    /// 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.
> -
> -  static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
> -                                const Twine &GVName, const DataLayout
> &DL);
> -
>    void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
>                           bool CannotUsePrivateLabel) const;
>    void getNameWithPrefix(SmallVectorImpl<char> &OutName, const
> GlobalValue *GV,
> @@ -59,10 +53,12 @@ public:
>
>    /// Print the appropriate prefix and the specified name as the global
> variable
>    /// name. GVName must not be empty.
> -  void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
> -                         ManglerPrefixTy PrefixTy = Mangler::Default)
> const;
> -  void getNameWithPrefix(SmallVectorImpl<char> &OutName, const Twine
> &GVName,
> -                         ManglerPrefixTy PrefixTy = Mangler::Default)
> const;
> +  static void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
> +                                const DataLayout &DL,
> +                                ManglerPrefixTy PrefixTy =
> Mangler::Default);
> +  static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
> +                                const Twine &GVName, const DataLayout &DL,
> +                                ManglerPrefixTy PrefixTy =
> Mangler::Default);
>  };
>
>  } // End llvm namespace
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Jun 23 08:59:29
> 2015
> @@ -179,7 +179,7 @@ bool AsmPrinter::doInitialization(Module
>
>    OutStreamer->InitSections(false);
>
> -  Mang = new Mangler(TM.getDataLayout());
> +  Mang = new Mangler();
>
>    // Emit the version-min deplyment target directive if needed.
>    //
> @@ -2292,11 +2292,10 @@ MCSymbol *AsmPrinter::getSymbolWithGloba
>                                                             TM);
>  }
>
> -/// GetExternalSymbolSymbol - Return the MCSymbol for the specified
> -/// ExternalSymbol.
> +/// Return the MCSymbol for the specified ExternalSymbol.
>  MCSymbol *AsmPrinter::GetExternalSymbolSymbol(StringRef Sym) const {
>    SmallString<60> NameStr;
> -  Mang->getNameWithPrefix(NameStr, Sym);
> +  Mangler::getNameWithPrefix(NameStr, Sym, *TM.getDataLayout());
>    return OutContext.getOrCreateSymbol(NameStr);
>  }
>
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp Tue Jun 23
> 08:59:29 2015
> @@ -58,7 +58,7 @@ static void EmitCamlGlobal(const Module
>    SymName[Letter] = toupper(SymName[Letter]);
>
>    SmallString<128> TmpStr;
> -  AP.Mang->getNameWithPrefix(TmpStr, SymName);
> +  Mangler::getNameWithPrefix(TmpStr, SymName, M.getDataLayout());
>
>    MCSymbol *Sym = AP.OutContext.getOrCreateSymbol(TmpStr);
>
>
> Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Tue Jun 23 08:59:29
> 2015
> @@ -181,9 +181,9 @@ uint64_t ExecutionEngineState::RemoveMap
>
>  std::string ExecutionEngine::getMangledName(const GlobalValue *GV) {
>    MutexGuard locked(lock);
> -  Mangler Mang(DL);
> +  Mangler Mang;
>    SmallString<128> FullName;
> -  Mang.getNameWithPrefix(FullName, GV->getName());
> +  Mang.getNameWithPrefix(FullName, GV, false);
>    return FullName.str();
>  }
>
>
> Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Tue Jun 23 08:59:29 2015
> @@ -264,9 +264,8 @@ void MCJIT::finalizeModule(Module *M) {
>  }
>
>  RuntimeDyld::SymbolInfo MCJIT::findExistingSymbol(const std::string
> &Name) {
> -  Mangler Mang(TM->getDataLayout());
>    SmallString<128> FullName;
> -  Mang.getNameWithPrefix(FullName, Name);
> +  Mangler::getNameWithPrefix(FullName, Name, *TM->getDataLayout());
>    return Dyld.getSymbol(FullName);
>  }
>
> @@ -369,7 +368,7 @@ uint64_t MCJIT::getFunctionAddress(const
>  void *MCJIT::getPointerToFunction(Function *F) {
>    MutexGuard locked(lock);
>
> -  Mangler Mang(TM->getDataLayout());
> +  Mangler Mang;
>    SmallString<128> Name;
>    TM->getNameWithPrefix(Name, F, Mang);
>
>
> Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h (original)
> +++ llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h Tue Jun 23
> 08:59:29 2015
> @@ -142,7 +142,6 @@ public:
>                      std::unique_ptr<TargetMachine> TM)
>        : TM(std::move(TM)), MemMgr(*this, std::move(MemMgr)),
>          Resolver(*this), ClientResolver(std::move(ClientResolver)),
> -        Mang(this->TM->getDataLayout()),
>          NotifyObjectLoaded(*this), NotifyFinalized(*this),
>          ObjectLayer(NotifyObjectLoaded, NotifyFinalized),
>          CompileLayer(ObjectLayer, SimpleCompiler(*this->TM)),
> @@ -311,7 +310,7 @@ private:
>      std::string MangledName;
>      {
>        raw_string_ostream MangledNameStream(MangledName);
> -      Mang.getNameWithPrefix(MangledNameStream, Name);
> +      Mang.getNameWithPrefix(MangledNameStream, Name,
> *TM->getDataLayout());
>      }
>      return MangledName;
>    }
>
> Modified: llvm/trunk/lib/IR/Mangler.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Mangler.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/IR/Mangler.cpp (original)
> +++ llvm/trunk/lib/IR/Mangler.cpp Tue Jun 23 08:59:29 2015
> @@ -17,6 +17,7 @@
>  #include "llvm/IR/DataLayout.h"
>  #include "llvm/IR/DerivedTypes.h"
>  #include "llvm/IR/Function.h"
> +#include "llvm/IR/Module.h"
>  #include "llvm/Support/raw_ostream.h"
>  using namespace llvm;
>
> @@ -47,24 +48,18 @@ static void getNameWithPrefixImpl(raw_os
>  }
>
>  void Mangler::getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
> -                                ManglerPrefixTy PrefixTy) const {
> -  char Prefix = DL->getGlobalPrefix();
> -  return getNameWithPrefixImpl(OS, GVName, PrefixTy, *DL, Prefix);
> -}
> -
> -void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
> -                                const Twine &GVName, const DataLayout
> &DL) {
> -  raw_svector_ostream OS(OutName);
> +                                const DataLayout &DL,
> +                                ManglerPrefixTy PrefixTy) {
>    char Prefix = DL.getGlobalPrefix();
> -  return getNameWithPrefixImpl(OS, GVName, Mangler::Default, DL, Prefix);
> +  return getNameWithPrefixImpl(OS, GVName, PrefixTy, DL, Prefix);
>  }
>
>  void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
> -                                const Twine &GVName,
> -                                ManglerPrefixTy PrefixTy) const {
> +                                const Twine &GVName, const DataLayout &DL,
> +                                ManglerPrefixTy PrefixTy) {
>    raw_svector_ostream OS(OutName);
> -  char Prefix = DL->getGlobalPrefix();
> -  return getNameWithPrefixImpl(OS, GVName, PrefixTy, *DL, Prefix);
> +  char Prefix = DL.getGlobalPrefix();
> +  return getNameWithPrefixImpl(OS, GVName, PrefixTy, DL, Prefix);
>  }
>
>  static bool hasByteCountSuffix(CallingConv::ID CC) {
> @@ -108,6 +103,7 @@ void Mangler::getNameWithPrefix(raw_ostr
>        PrefixTy = Mangler::Private;
>    }
>
> +  const DataLayout &DL = GV->getParent()->getDataLayout();
>    if (!GV->hasName()) {
>      // Get the ID for the global, assigning a new one if we haven't got
> one
>      // already.
> @@ -116,12 +112,12 @@ void Mangler::getNameWithPrefix(raw_ostr
>        ID = NextAnonGlobalID++;
>
>      // Must mangle the global into a unique ID.
> -    getNameWithPrefix(OS, "__unnamed_" + Twine(ID), PrefixTy);
> +    getNameWithPrefix(OS, "__unnamed_" + Twine(ID), DL, PrefixTy);
>      return;
>    }
>
>    StringRef Name = GV->getName();
> -  char Prefix = DL->getGlobalPrefix();
> +  char Prefix = DL.getGlobalPrefix();
>
>    // Mangle functions with Microsoft calling conventions specially.  Only
> do
>    // this mangling for x86_64 vectorcall and 32-bit x86.
> @@ -130,7 +126,7 @@ void Mangler::getNameWithPrefix(raw_ostr
>      MSFunc = nullptr; // Don't mangle when \01 is present.
>    CallingConv::ID CC =
>        MSFunc ? MSFunc->getCallingConv() : (unsigned)CallingConv::C;
> -  if (!DL->hasMicrosoftFastStdCallMangling() &&
> +  if (!DL.hasMicrosoftFastStdCallMangling() &&
>        CC != CallingConv::X86_VectorCall)
>      MSFunc = nullptr;
>    if (MSFunc) {
> @@ -140,7 +136,7 @@ void Mangler::getNameWithPrefix(raw_ostr
>        Prefix = '\0'; // vectorcall functions have no prefix.
>    }
>
> -  getNameWithPrefixImpl(OS, Name, PrefixTy, *DL, Prefix);
> +  getNameWithPrefixImpl(OS, Name, PrefixTy, DL, Prefix);
>
>    if (!MSFunc)
>      return;
> @@ -155,7 +151,7 @@ void Mangler::getNameWithPrefix(raw_ostr
>        // "Pure" variadic functions do not receive @0 suffix.
>        (!FT->isVarArg() || FT->getNumParams() == 0 ||
>         (FT->getNumParams() == 1 && MSFunc->hasStructRetAttr())))
> -    addByteCountSuffix(OS, MSFunc, *DL);
> +    addByteCountSuffix(OS, MSFunc, DL);
>  }
>
>  void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
>
> Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)
> +++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Tue Jun 23 08:59:29 2015
> @@ -453,7 +453,7 @@ void LTOCodeGenerator::applyScopeRestric
>    passes.add(createVerifierPass());
>
>    // mark which symbols can not be internalized
> -  Mangler Mangler(TargetMach->getDataLayout());
> +  Mangler Mangler;
>    std::vector<const char*> MustPreserveList;
>    SmallPtrSet<GlobalValue*, 8> AsmUsed;
>    std::vector<StringRef> Libcalls;
>
> Modified: llvm/trunk/lib/Object/IRObjectFile.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRObjectFile.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Object/IRObjectFile.cpp (original)
> +++ llvm/trunk/lib/Object/IRObjectFile.cpp Tue Jun 23 08:59:29 2015
> @@ -37,9 +37,7 @@ using namespace object;
>
>  IRObjectFile::IRObjectFile(MemoryBufferRef Object,
> std::unique_ptr<Module> Mod)
>      : SymbolicFile(Binary::ID_IR, Object), M(std::move(Mod)) {
> -  // Setup a mangler with the DataLayout.
> -  const DataLayout &DL = M->getDataLayout();
> -  Mang.reset(new Mangler(&DL));
> +  Mang.reset(new Mangler());
>
>    const std::string &InlineAsm = M->getModuleInlineAsm();
>    if (InlineAsm.empty())
>
> Modified: llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (original)
> +++ llvm/trunk/lib/Target/NVPTX/NVPTXAsmPrinter.cpp Tue Jun 23 08:59:29
> 2015
> @@ -826,7 +826,7 @@ bool NVPTXAsmPrinter::doInitialization(M
>    const_cast<TargetLoweringObjectFile &>(getObjFileLowering())
>        .Initialize(OutContext, TM);
>
> -  Mang = new Mangler(TM.getDataLayout());
> +  Mang = new Mangler();
>
>    // Emit header before any dwarf directives are emitted below.
>    emitHeader(M, OS1, STI);
>
> Modified: llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp (original)
> +++ llvm/trunk/lib/Target/PowerPC/PPCMCInstLower.cpp Tue Jun 23 08:59:29
> 2015
> @@ -57,7 +57,7 @@ static MCSymbol *GetSymbolFromOperand(co
>
>    if (!MO.isGlobal()) {
>      assert(MO.isSymbol() && "Isn't a symbol reference");
> -    Mang->getNameWithPrefix(Name, MO.getSymbolName());
> +    Mangler::getNameWithPrefix(Name, MO.getSymbolName(), *DL);
>    } else {
>      const GlobalValue *GV = MO.getGlobal();
>      TM.getNameWithPrefix(Name, GV, *Mang);
>
> Modified: llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCInstLower.cpp?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp Tue Jun 23 08:59:29 2015
> @@ -159,7 +159,7 @@ GetSymbolFromOperand(const MachineOperan
>      const GlobalValue *GV = MO.getGlobal();
>      AsmPrinter.getNameWithPrefix(Name, GV);
>    } else if (MO.isSymbol()) {
> -    getMang()->getNameWithPrefix(Name, MO.getSymbolName());
> +    Mangler::getNameWithPrefix(Name, MO.getSymbolName(), *DL);
>    } else if (MO.isMBB()) {
>      assert(Suffix.empty());
>      Sym = MO.getMBB()->getSymbol();
>
> Modified: llvm/trunk/tools/lli/OrcLazyJIT.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.h?rev=240405&r1=240404&r2=240405&view=diff
>
> ==============================================================================
> --- llvm/trunk/tools/lli/OrcLazyJIT.h (original)
> +++ llvm/trunk/tools/lli/OrcLazyJIT.h Tue Jun 23 08:59:29 2015
> @@ -50,7 +50,6 @@ public:
>    OrcLazyJIT(std::unique_ptr<TargetMachine> TM, LLVMContext &Context,
>               CallbackManagerBuilder &BuildCallbackMgr)
>      : TM(std::move(TM)),
> -      Mang(this->TM->getDataLayout()),
>        ObjectLayer(),
>        CompileLayer(ObjectLayer, orc::SimpleCompiler(*this->TM)),
>        IRDumpLayer(CompileLayer, createDebugDumper()),
> @@ -137,7 +136,7 @@ private:
>      std::string MangledName;
>      {
>        raw_string_ostream MangledNameStream(MangledName);
> -      Mang.getNameWithPrefix(MangledNameStream, Name);
> +      Mangler::getNameWithPrefix(MangledNameStream, Name,
> *TM->getDataLayout());
>      }
>      return MangledName;
>    }
> @@ -145,7 +144,6 @@ private:
>    static TransformFtor createDebugDumper();
>
>    std::unique_ptr<TargetMachine> TM;
> -  Mangler Mang;
>    SectionMemoryManager CCMgrMemMgr;
>
>    ObjLayerT ObjectLayer;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150712/b688c046/attachment.html>


More information about the llvm-commits mailing list