mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
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. llvm-svn: 240405
This commit is contained in:
parent
479995f6f0
commit
72dc307fa0
@ -1168,7 +1168,6 @@ public:
|
|||||||
|
|
||||||
KaleidoscopeJIT(SessionContext &Session)
|
KaleidoscopeJIT(SessionContext &Session)
|
||||||
: Session(Session),
|
: Session(Session),
|
||||||
Mang(Session.getTarget().getDataLayout()),
|
|
||||||
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
|
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
|
||||||
LazyEmitLayer(CompileLayer),
|
LazyEmitLayer(CompileLayer),
|
||||||
CompileCallbacks(LazyEmitLayer, CCMgrMemMgr, Session.getLLVMContext(),
|
CompileCallbacks(LazyEmitLayer, CCMgrMemMgr, Session.getLLVMContext(),
|
||||||
@ -1179,7 +1178,8 @@ public:
|
|||||||
std::string MangledName;
|
std::string MangledName;
|
||||||
{
|
{
|
||||||
raw_string_ostream MangledNameStream(MangledName);
|
raw_string_ostream MangledNameStream(MangledName);
|
||||||
Mang.getNameWithPrefix(MangledNameStream, Name);
|
Mangler::getNameWithPrefix(MangledNameStream, Name,
|
||||||
|
*Session.getTarget().getDataLayout());
|
||||||
}
|
}
|
||||||
return MangledName;
|
return MangledName;
|
||||||
}
|
}
|
||||||
@ -1306,7 +1306,6 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
SessionContext &Session;
|
SessionContext &Session;
|
||||||
Mangler Mang;
|
|
||||||
SectionMemoryManager CCMgrMemMgr;
|
SectionMemoryManager CCMgrMemMgr;
|
||||||
ObjLayerT ObjectLayer;
|
ObjLayerT ObjectLayer;
|
||||||
CompileLayerT CompileLayer;
|
CompileLayerT CompileLayer;
|
||||||
|
@ -1160,14 +1160,14 @@ public:
|
|||||||
typedef CompileLayerT::ModuleSetHandleT ModuleHandleT;
|
typedef CompileLayerT::ModuleSetHandleT ModuleHandleT;
|
||||||
|
|
||||||
KaleidoscopeJIT(SessionContext &Session)
|
KaleidoscopeJIT(SessionContext &Session)
|
||||||
: Mang(Session.getTarget().getDataLayout()),
|
: DL(*Session.getTarget().getDataLayout()),
|
||||||
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())) {}
|
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())) {}
|
||||||
|
|
||||||
std::string mangle(const std::string &Name) {
|
std::string mangle(const std::string &Name) {
|
||||||
std::string MangledName;
|
std::string MangledName;
|
||||||
{
|
{
|
||||||
raw_string_ostream MangledNameStream(MangledName);
|
raw_string_ostream MangledNameStream(MangledName);
|
||||||
Mang.getNameWithPrefix(MangledNameStream, Name);
|
Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
|
||||||
}
|
}
|
||||||
return MangledName;
|
return MangledName;
|
||||||
}
|
}
|
||||||
@ -1201,8 +1201,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const DataLayout &DL;
|
||||||
Mangler Mang;
|
|
||||||
ObjLayerT ObjectLayer;
|
ObjLayerT ObjectLayer;
|
||||||
CompileLayerT CompileLayer;
|
CompileLayerT CompileLayer;
|
||||||
};
|
};
|
||||||
|
@ -1162,15 +1162,15 @@ public:
|
|||||||
typedef LazyEmitLayerT::ModuleSetHandleT ModuleHandleT;
|
typedef LazyEmitLayerT::ModuleSetHandleT ModuleHandleT;
|
||||||
|
|
||||||
KaleidoscopeJIT(SessionContext &Session)
|
KaleidoscopeJIT(SessionContext &Session)
|
||||||
: Mang(Session.getTarget().getDataLayout()),
|
: DL(*Session.getTarget().getDataLayout()),
|
||||||
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
|
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
|
||||||
LazyEmitLayer(CompileLayer) {}
|
LazyEmitLayer(CompileLayer) {}
|
||||||
|
|
||||||
std::string mangle(const std::string &Name) {
|
std::string mangle(const std::string &Name) {
|
||||||
std::string MangledName;
|
std::string MangledName;
|
||||||
{
|
{
|
||||||
raw_string_ostream MangledNameStream(MangledName);
|
raw_string_ostream MangledNameStream(MangledName);
|
||||||
Mang.getNameWithPrefix(MangledNameStream, Name);
|
Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
|
||||||
}
|
}
|
||||||
return MangledName;
|
return MangledName;
|
||||||
}
|
}
|
||||||
@ -1204,8 +1204,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const DataLayout &DL;
|
||||||
Mangler Mang;
|
|
||||||
ObjLayerT ObjectLayer;
|
ObjLayerT ObjectLayer;
|
||||||
CompileLayerT CompileLayer;
|
CompileLayerT CompileLayer;
|
||||||
LazyEmitLayerT LazyEmitLayer;
|
LazyEmitLayerT LazyEmitLayer;
|
||||||
|
@ -1162,7 +1162,6 @@ public:
|
|||||||
|
|
||||||
KaleidoscopeJIT(SessionContext &Session)
|
KaleidoscopeJIT(SessionContext &Session)
|
||||||
: Session(Session),
|
: Session(Session),
|
||||||
Mang(Session.getTarget().getDataLayout()),
|
|
||||||
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
|
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),
|
||||||
LazyEmitLayer(CompileLayer) {}
|
LazyEmitLayer(CompileLayer) {}
|
||||||
|
|
||||||
@ -1170,7 +1169,8 @@ public:
|
|||||||
std::string MangledName;
|
std::string MangledName;
|
||||||
{
|
{
|
||||||
raw_string_ostream MangledNameStream(MangledName);
|
raw_string_ostream MangledNameStream(MangledName);
|
||||||
Mang.getNameWithPrefix(MangledNameStream, Name);
|
Mangler::getNameWithPrefix(MangledNameStream, Name,
|
||||||
|
*Session.getTarget().getDataLayout());
|
||||||
}
|
}
|
||||||
return MangledName;
|
return MangledName;
|
||||||
}
|
}
|
||||||
@ -1236,7 +1236,6 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
SessionContext &Session;
|
SessionContext &Session;
|
||||||
Mangler Mang;
|
|
||||||
ObjLayerT ObjectLayer;
|
ObjLayerT ObjectLayer;
|
||||||
CompileLayerT CompileLayer;
|
CompileLayerT CompileLayer;
|
||||||
LazyEmitLayerT LazyEmitLayer;
|
LazyEmitLayerT LazyEmitLayer;
|
||||||
|
@ -241,11 +241,10 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static std::string Mangle(StringRef Name, const DataLayout &DL) {
|
static std::string Mangle(StringRef Name, const DataLayout &DL) {
|
||||||
Mangler M(&DL);
|
|
||||||
std::string MangledName;
|
std::string MangledName;
|
||||||
{
|
{
|
||||||
raw_string_ostream MangledNameStream(MangledName);
|
raw_string_ostream MangledNameStream(MangledName);
|
||||||
M.getNameWithPrefix(MangledNameStream, Name);
|
Mangler::getNameWithPrefix(MangledNameStream, Name, DL);
|
||||||
}
|
}
|
||||||
return MangledName;
|
return MangledName;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ private:
|
|||||||
auto Symbols = llvm::make_unique<StringMap<const GlobalValue*>>();
|
auto Symbols = llvm::make_unique<StringMap<const GlobalValue*>>();
|
||||||
|
|
||||||
for (const auto &M : Ms) {
|
for (const auto &M : Ms) {
|
||||||
Mangler Mang(&M->getDataLayout());
|
Mangler Mang;
|
||||||
|
|
||||||
for (const auto &V : M->globals())
|
for (const auto &V : M->globals())
|
||||||
if (auto GV = addGlobalValue(*Symbols, V, Mang, SearchName,
|
if (auto GV = addGlobalValue(*Symbols, V, Mang, SearchName,
|
||||||
|
@ -33,8 +33,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const DataLayout *DL;
|
|
||||||
|
|
||||||
/// We need to give global values the same name every time they are mangled.
|
/// 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.
|
/// This keeps track of the number we give to anonymous ones.
|
||||||
mutable DenseMap<const GlobalValue*, unsigned> AnonGlobalIDs;
|
mutable DenseMap<const GlobalValue*, unsigned> AnonGlobalIDs;
|
||||||
@ -43,15 +41,11 @@ private:
|
|||||||
mutable unsigned NextAnonGlobalID;
|
mutable unsigned NextAnonGlobalID;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Mangler(const DataLayout *DL) : DL(DL), NextAnonGlobalID(1) {}
|
Mangler() : NextAnonGlobalID(1) {}
|
||||||
|
|
||||||
/// Print the appropriate prefix and the specified global variable's name.
|
/// 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
|
/// If the global variable doesn't have a name, this fills in a unique name
|
||||||
/// for the global.
|
/// for the global.
|
||||||
|
|
||||||
static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
|
||||||
const Twine &GVName, const DataLayout &DL);
|
|
||||||
|
|
||||||
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
void getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
||||||
bool CannotUsePrivateLabel) const;
|
bool CannotUsePrivateLabel) const;
|
||||||
void getNameWithPrefix(SmallVectorImpl<char> &OutName, const GlobalValue *GV,
|
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
|
/// Print the appropriate prefix and the specified name as the global variable
|
||||||
/// name. GVName must not be empty.
|
/// name. GVName must not be empty.
|
||||||
void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
|
static void getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
|
||||||
ManglerPrefixTy PrefixTy = Mangler::Default) const;
|
const DataLayout &DL,
|
||||||
void getNameWithPrefix(SmallVectorImpl<char> &OutName, const Twine &GVName,
|
ManglerPrefixTy PrefixTy = Mangler::Default);
|
||||||
ManglerPrefixTy PrefixTy = Mangler::Default) const;
|
static void getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
||||||
|
const Twine &GVName, const DataLayout &DL,
|
||||||
|
ManglerPrefixTy PrefixTy = Mangler::Default);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
@ -179,7 +179,7 @@ bool AsmPrinter::doInitialization(Module &M) {
|
|||||||
|
|
||||||
OutStreamer->InitSections(false);
|
OutStreamer->InitSections(false);
|
||||||
|
|
||||||
Mang = new Mangler(TM.getDataLayout());
|
Mang = new Mangler();
|
||||||
|
|
||||||
// Emit the version-min deplyment target directive if needed.
|
// Emit the version-min deplyment target directive if needed.
|
||||||
//
|
//
|
||||||
@ -2292,11 +2292,10 @@ MCSymbol *AsmPrinter::getSymbolWithGlobalValueBase(const GlobalValue *GV,
|
|||||||
TM);
|
TM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// GetExternalSymbolSymbol - Return the MCSymbol for the specified
|
/// Return the MCSymbol for the specified ExternalSymbol.
|
||||||
/// ExternalSymbol.
|
|
||||||
MCSymbol *AsmPrinter::GetExternalSymbolSymbol(StringRef Sym) const {
|
MCSymbol *AsmPrinter::GetExternalSymbolSymbol(StringRef Sym) const {
|
||||||
SmallString<60> NameStr;
|
SmallString<60> NameStr;
|
||||||
Mang->getNameWithPrefix(NameStr, Sym);
|
Mangler::getNameWithPrefix(NameStr, Sym, *TM.getDataLayout());
|
||||||
return OutContext.getOrCreateSymbol(NameStr);
|
return OutContext.getOrCreateSymbol(NameStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ static void EmitCamlGlobal(const Module &M, AsmPrinter &AP, const char *Id) {
|
|||||||
SymName[Letter] = toupper(SymName[Letter]);
|
SymName[Letter] = toupper(SymName[Letter]);
|
||||||
|
|
||||||
SmallString<128> TmpStr;
|
SmallString<128> TmpStr;
|
||||||
AP.Mang->getNameWithPrefix(TmpStr, SymName);
|
Mangler::getNameWithPrefix(TmpStr, SymName, M.getDataLayout());
|
||||||
|
|
||||||
MCSymbol *Sym = AP.OutContext.getOrCreateSymbol(TmpStr);
|
MCSymbol *Sym = AP.OutContext.getOrCreateSymbol(TmpStr);
|
||||||
|
|
||||||
|
@ -181,9 +181,9 @@ uint64_t ExecutionEngineState::RemoveMapping(StringRef Name) {
|
|||||||
|
|
||||||
std::string ExecutionEngine::getMangledName(const GlobalValue *GV) {
|
std::string ExecutionEngine::getMangledName(const GlobalValue *GV) {
|
||||||
MutexGuard locked(lock);
|
MutexGuard locked(lock);
|
||||||
Mangler Mang(DL);
|
Mangler Mang;
|
||||||
SmallString<128> FullName;
|
SmallString<128> FullName;
|
||||||
Mang.getNameWithPrefix(FullName, GV->getName());
|
Mang.getNameWithPrefix(FullName, GV, false);
|
||||||
return FullName.str();
|
return FullName.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,9 +264,8 @@ void MCJIT::finalizeModule(Module *M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RuntimeDyld::SymbolInfo MCJIT::findExistingSymbol(const std::string &Name) {
|
RuntimeDyld::SymbolInfo MCJIT::findExistingSymbol(const std::string &Name) {
|
||||||
Mangler Mang(TM->getDataLayout());
|
|
||||||
SmallString<128> FullName;
|
SmallString<128> FullName;
|
||||||
Mang.getNameWithPrefix(FullName, Name);
|
Mangler::getNameWithPrefix(FullName, Name, *TM->getDataLayout());
|
||||||
return Dyld.getSymbol(FullName);
|
return Dyld.getSymbol(FullName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +368,7 @@ uint64_t MCJIT::getFunctionAddress(const std::string &Name) {
|
|||||||
void *MCJIT::getPointerToFunction(Function *F) {
|
void *MCJIT::getPointerToFunction(Function *F) {
|
||||||
MutexGuard locked(lock);
|
MutexGuard locked(lock);
|
||||||
|
|
||||||
Mangler Mang(TM->getDataLayout());
|
Mangler Mang;
|
||||||
SmallString<128> Name;
|
SmallString<128> Name;
|
||||||
TM->getNameWithPrefix(Name, F, Mang);
|
TM->getNameWithPrefix(Name, F, Mang);
|
||||||
|
|
||||||
|
@ -142,7 +142,6 @@ public:
|
|||||||
std::unique_ptr<TargetMachine> TM)
|
std::unique_ptr<TargetMachine> TM)
|
||||||
: TM(std::move(TM)), MemMgr(*this, std::move(MemMgr)),
|
: TM(std::move(TM)), MemMgr(*this, std::move(MemMgr)),
|
||||||
Resolver(*this), ClientResolver(std::move(ClientResolver)),
|
Resolver(*this), ClientResolver(std::move(ClientResolver)),
|
||||||
Mang(this->TM->getDataLayout()),
|
|
||||||
NotifyObjectLoaded(*this), NotifyFinalized(*this),
|
NotifyObjectLoaded(*this), NotifyFinalized(*this),
|
||||||
ObjectLayer(NotifyObjectLoaded, NotifyFinalized),
|
ObjectLayer(NotifyObjectLoaded, NotifyFinalized),
|
||||||
CompileLayer(ObjectLayer, SimpleCompiler(*this->TM)),
|
CompileLayer(ObjectLayer, SimpleCompiler(*this->TM)),
|
||||||
@ -311,7 +310,7 @@ private:
|
|||||||
std::string MangledName;
|
std::string MangledName;
|
||||||
{
|
{
|
||||||
raw_string_ostream MangledNameStream(MangledName);
|
raw_string_ostream MangledNameStream(MangledName);
|
||||||
Mang.getNameWithPrefix(MangledNameStream, Name);
|
Mang.getNameWithPrefix(MangledNameStream, Name, *TM->getDataLayout());
|
||||||
}
|
}
|
||||||
return MangledName;
|
return MangledName;
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "llvm/IR/DataLayout.h"
|
#include "llvm/IR/DataLayout.h"
|
||||||
#include "llvm/IR/DerivedTypes.h"
|
#include "llvm/IR/DerivedTypes.h"
|
||||||
#include "llvm/IR/Function.h"
|
#include "llvm/IR/Function.h"
|
||||||
|
#include "llvm/IR/Module.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
@ -47,24 +48,18 @@ static void getNameWithPrefixImpl(raw_ostream &OS, const Twine &GVName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Mangler::getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
|
void Mangler::getNameWithPrefix(raw_ostream &OS, const Twine &GVName,
|
||||||
ManglerPrefixTy PrefixTy) const {
|
const DataLayout &DL,
|
||||||
char Prefix = DL->getGlobalPrefix();
|
ManglerPrefixTy PrefixTy) {
|
||||||
return getNameWithPrefixImpl(OS, GVName, PrefixTy, *DL, Prefix);
|
char Prefix = DL.getGlobalPrefix();
|
||||||
|
return getNameWithPrefixImpl(OS, GVName, PrefixTy, DL, Prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
||||||
const Twine &GVName, const DataLayout &DL) {
|
const Twine &GVName, const DataLayout &DL,
|
||||||
|
ManglerPrefixTy PrefixTy) {
|
||||||
raw_svector_ostream OS(OutName);
|
raw_svector_ostream OS(OutName);
|
||||||
char Prefix = DL.getGlobalPrefix();
|
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 {
|
|
||||||
raw_svector_ostream OS(OutName);
|
|
||||||
char Prefix = DL->getGlobalPrefix();
|
|
||||||
return getNameWithPrefixImpl(OS, GVName, PrefixTy, *DL, Prefix);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool hasByteCountSuffix(CallingConv::ID CC) {
|
static bool hasByteCountSuffix(CallingConv::ID CC) {
|
||||||
@ -108,6 +103,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
|||||||
PrefixTy = Mangler::Private;
|
PrefixTy = Mangler::Private;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DataLayout &DL = GV->getParent()->getDataLayout();
|
||||||
if (!GV->hasName()) {
|
if (!GV->hasName()) {
|
||||||
// Get the ID for the global, assigning a new one if we haven't got one
|
// Get the ID for the global, assigning a new one if we haven't got one
|
||||||
// already.
|
// already.
|
||||||
@ -116,12 +112,12 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
|||||||
ID = NextAnonGlobalID++;
|
ID = NextAnonGlobalID++;
|
||||||
|
|
||||||
// Must mangle the global into a unique ID.
|
// Must mangle the global into a unique ID.
|
||||||
getNameWithPrefix(OS, "__unnamed_" + Twine(ID), PrefixTy);
|
getNameWithPrefix(OS, "__unnamed_" + Twine(ID), DL, PrefixTy);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef Name = GV->getName();
|
StringRef Name = GV->getName();
|
||||||
char Prefix = DL->getGlobalPrefix();
|
char Prefix = DL.getGlobalPrefix();
|
||||||
|
|
||||||
// Mangle functions with Microsoft calling conventions specially. Only do
|
// Mangle functions with Microsoft calling conventions specially. Only do
|
||||||
// this mangling for x86_64 vectorcall and 32-bit x86.
|
// this mangling for x86_64 vectorcall and 32-bit x86.
|
||||||
@ -130,7 +126,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
|||||||
MSFunc = nullptr; // Don't mangle when \01 is present.
|
MSFunc = nullptr; // Don't mangle when \01 is present.
|
||||||
CallingConv::ID CC =
|
CallingConv::ID CC =
|
||||||
MSFunc ? MSFunc->getCallingConv() : (unsigned)CallingConv::C;
|
MSFunc ? MSFunc->getCallingConv() : (unsigned)CallingConv::C;
|
||||||
if (!DL->hasMicrosoftFastStdCallMangling() &&
|
if (!DL.hasMicrosoftFastStdCallMangling() &&
|
||||||
CC != CallingConv::X86_VectorCall)
|
CC != CallingConv::X86_VectorCall)
|
||||||
MSFunc = nullptr;
|
MSFunc = nullptr;
|
||||||
if (MSFunc) {
|
if (MSFunc) {
|
||||||
@ -140,7 +136,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
|||||||
Prefix = '\0'; // vectorcall functions have no prefix.
|
Prefix = '\0'; // vectorcall functions have no prefix.
|
||||||
}
|
}
|
||||||
|
|
||||||
getNameWithPrefixImpl(OS, Name, PrefixTy, *DL, Prefix);
|
getNameWithPrefixImpl(OS, Name, PrefixTy, DL, Prefix);
|
||||||
|
|
||||||
if (!MSFunc)
|
if (!MSFunc)
|
||||||
return;
|
return;
|
||||||
@ -155,7 +151,7 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
|
|||||||
// "Pure" variadic functions do not receive @0 suffix.
|
// "Pure" variadic functions do not receive @0 suffix.
|
||||||
(!FT->isVarArg() || FT->getNumParams() == 0 ||
|
(!FT->isVarArg() || FT->getNumParams() == 0 ||
|
||||||
(FT->getNumParams() == 1 && MSFunc->hasStructRetAttr())))
|
(FT->getNumParams() == 1 && MSFunc->hasStructRetAttr())))
|
||||||
addByteCountSuffix(OS, MSFunc, *DL);
|
addByteCountSuffix(OS, MSFunc, DL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
void Mangler::getNameWithPrefix(SmallVectorImpl<char> &OutName,
|
||||||
|
@ -453,7 +453,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
|
|||||||
passes.add(createVerifierPass());
|
passes.add(createVerifierPass());
|
||||||
|
|
||||||
// mark which symbols can not be internalized
|
// mark which symbols can not be internalized
|
||||||
Mangler Mangler(TargetMach->getDataLayout());
|
Mangler Mangler;
|
||||||
std::vector<const char*> MustPreserveList;
|
std::vector<const char*> MustPreserveList;
|
||||||
SmallPtrSet<GlobalValue*, 8> AsmUsed;
|
SmallPtrSet<GlobalValue*, 8> AsmUsed;
|
||||||
std::vector<StringRef> Libcalls;
|
std::vector<StringRef> Libcalls;
|
||||||
|
@ -37,9 +37,7 @@ using namespace object;
|
|||||||
|
|
||||||
IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr<Module> Mod)
|
IRObjectFile::IRObjectFile(MemoryBufferRef Object, std::unique_ptr<Module> Mod)
|
||||||
: SymbolicFile(Binary::ID_IR, Object), M(std::move(Mod)) {
|
: SymbolicFile(Binary::ID_IR, Object), M(std::move(Mod)) {
|
||||||
// Setup a mangler with the DataLayout.
|
Mang.reset(new Mangler());
|
||||||
const DataLayout &DL = M->getDataLayout();
|
|
||||||
Mang.reset(new Mangler(&DL));
|
|
||||||
|
|
||||||
const std::string &InlineAsm = M->getModuleInlineAsm();
|
const std::string &InlineAsm = M->getModuleInlineAsm();
|
||||||
if (InlineAsm.empty())
|
if (InlineAsm.empty())
|
||||||
|
@ -826,7 +826,7 @@ bool NVPTXAsmPrinter::doInitialization(Module &M) {
|
|||||||
const_cast<TargetLoweringObjectFile &>(getObjFileLowering())
|
const_cast<TargetLoweringObjectFile &>(getObjFileLowering())
|
||||||
.Initialize(OutContext, TM);
|
.Initialize(OutContext, TM);
|
||||||
|
|
||||||
Mang = new Mangler(TM.getDataLayout());
|
Mang = new Mangler();
|
||||||
|
|
||||||
// Emit header before any dwarf directives are emitted below.
|
// Emit header before any dwarf directives are emitted below.
|
||||||
emitHeader(M, OS1, STI);
|
emitHeader(M, OS1, STI);
|
||||||
|
@ -57,7 +57,7 @@ static MCSymbol *GetSymbolFromOperand(const MachineOperand &MO, AsmPrinter &AP){
|
|||||||
|
|
||||||
if (!MO.isGlobal()) {
|
if (!MO.isGlobal()) {
|
||||||
assert(MO.isSymbol() && "Isn't a symbol reference");
|
assert(MO.isSymbol() && "Isn't a symbol reference");
|
||||||
Mang->getNameWithPrefix(Name, MO.getSymbolName());
|
Mangler::getNameWithPrefix(Name, MO.getSymbolName(), *DL);
|
||||||
} else {
|
} else {
|
||||||
const GlobalValue *GV = MO.getGlobal();
|
const GlobalValue *GV = MO.getGlobal();
|
||||||
TM.getNameWithPrefix(Name, GV, *Mang);
|
TM.getNameWithPrefix(Name, GV, *Mang);
|
||||||
|
@ -159,7 +159,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
|||||||
const GlobalValue *GV = MO.getGlobal();
|
const GlobalValue *GV = MO.getGlobal();
|
||||||
AsmPrinter.getNameWithPrefix(Name, GV);
|
AsmPrinter.getNameWithPrefix(Name, GV);
|
||||||
} else if (MO.isSymbol()) {
|
} else if (MO.isSymbol()) {
|
||||||
getMang()->getNameWithPrefix(Name, MO.getSymbolName());
|
Mangler::getNameWithPrefix(Name, MO.getSymbolName(), *DL);
|
||||||
} else if (MO.isMBB()) {
|
} else if (MO.isMBB()) {
|
||||||
assert(Suffix.empty());
|
assert(Suffix.empty());
|
||||||
Sym = MO.getMBB()->getSymbol();
|
Sym = MO.getMBB()->getSymbol();
|
||||||
|
@ -50,7 +50,6 @@ public:
|
|||||||
OrcLazyJIT(std::unique_ptr<TargetMachine> TM, LLVMContext &Context,
|
OrcLazyJIT(std::unique_ptr<TargetMachine> TM, LLVMContext &Context,
|
||||||
CallbackManagerBuilder &BuildCallbackMgr)
|
CallbackManagerBuilder &BuildCallbackMgr)
|
||||||
: TM(std::move(TM)),
|
: TM(std::move(TM)),
|
||||||
Mang(this->TM->getDataLayout()),
|
|
||||||
ObjectLayer(),
|
ObjectLayer(),
|
||||||
CompileLayer(ObjectLayer, orc::SimpleCompiler(*this->TM)),
|
CompileLayer(ObjectLayer, orc::SimpleCompiler(*this->TM)),
|
||||||
IRDumpLayer(CompileLayer, createDebugDumper()),
|
IRDumpLayer(CompileLayer, createDebugDumper()),
|
||||||
@ -137,7 +136,7 @@ private:
|
|||||||
std::string MangledName;
|
std::string MangledName;
|
||||||
{
|
{
|
||||||
raw_string_ostream MangledNameStream(MangledName);
|
raw_string_ostream MangledNameStream(MangledName);
|
||||||
Mang.getNameWithPrefix(MangledNameStream, Name);
|
Mangler::getNameWithPrefix(MangledNameStream, Name, *TM->getDataLayout());
|
||||||
}
|
}
|
||||||
return MangledName;
|
return MangledName;
|
||||||
}
|
}
|
||||||
@ -145,7 +144,6 @@ private:
|
|||||||
static TransformFtor createDebugDumper();
|
static TransformFtor createDebugDumper();
|
||||||
|
|
||||||
std::unique_ptr<TargetMachine> TM;
|
std::unique_ptr<TargetMachine> TM;
|
||||||
Mangler Mang;
|
|
||||||
SectionMemoryManager CCMgrMemMgr;
|
SectionMemoryManager CCMgrMemMgr;
|
||||||
|
|
||||||
ObjLayerT ObjectLayer;
|
ObjLayerT ObjectLayer;
|
||||||
|
Loading…
Reference in New Issue
Block a user