summaryrefslogtreecommitdiff
path: root/lib/ExecutionEngine/MCJIT/MCJIT.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ExecutionEngine/MCJIT/MCJIT.cpp')
-rw-r--r--lib/ExecutionEngine/MCJIT/MCJIT.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/lib/ExecutionEngine/MCJIT/MCJIT.cpp
index 87243e4221f4..a7d67050c7a6 100644
--- a/lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ b/lib/ExecutionEngine/MCJIT/MCJIT.cpp
@@ -147,8 +147,6 @@ std::unique_ptr<MemoryBuffer> MCJIT::emitObject(Module *M) {
legacy::PassManager PM;
- M->setDataLayout(*TM->getDataLayout());
-
// The RuntimeDyld will take ownership of this shortly
SmallVector<char, 4096> ObjBufferSV;
raw_svector_ostream ObjStream(ObjBufferSV);
@@ -195,6 +193,8 @@ void MCJIT::generateCodeForModule(Module *M) {
if (ObjCache)
ObjectToLoad = ObjCache->getObject(M);
+ M->setDataLayout(*TM->getDataLayout());
+
// If the cache did not contain a suitable object, compile the object
if (!ObjectToLoad) {
ObjectToLoad = emitObject(M);
@@ -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 std::string &Name) {
void *MCJIT::getPointerToFunction(Function *F) {
MutexGuard locked(lock);
- Mangler Mang(TM->getDataLayout());
+ Mangler Mang;
SmallString<128> Name;
TM->getNameWithPrefix(Name, F, Mang);