<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Oh OK I didn’t know it was in the LLVM repo. The doc mentions the external gold repository, that’s why I backed off.<div class=""><div class=""><br class=""></div><div class="">Chandler fixed it.</div><div class=""><br class=""></div><div class="">— </div><div class="">Mehdi</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 24, 2015, at 10:23 AM, Reid Kleckner <<a href="mailto:rnk@google.com" class="">rnk@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">It's in llvm/tools/gold.</div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Jul 24, 2015 at 10:15 AM, Mehdi Amini <span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi,<div class=""><br class=""></div><div class="">Is it this project: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_GoldPlugin.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=MdB-wggv0aMa6pNbmFMKmmhH6e5LlTlzIhJmLrOLHk4&e=" target="_blank" class="">http://llvm.org/docs/GoldPlugin.html</a> ?</div><div class="">I probably can’t contribute, but I can hint you about how to do it, the lines you are quoting should be replaced by:</div><div class=""><br class=""></div><div class=""><div class=""> M.setDataLayout(TM.createDataLayout());<br class=""></div><div class=""><br class=""></div><div class="">— </div><span class="HOEnZb"><font color="#888888" class=""><div class="">Mehdi</div></font></span><div class=""><div class="h5"><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 24, 2015, at 10:05 AM, Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank" class="">rnk@google.com</a>> wrote:</div><br class=""><div class=""><div dir="ltr" class="">Can you fix gold plugin? It does this currently:<div class=""><br class=""></div><div class=""><div class=""> if (const DataLayout *DL = TM.getDataLayout())</div><div class=""> M.setDataLayout(*DL);</div><div class=""><br class=""></div></div><div class="">I'm not 100% sure what the fix is from your change.</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Jul 24, 2015 at 9:04 AM, Mehdi Amini <span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: mehdi_amini<br class="">
Date: Fri Jul 24 11:04:22 2015<br class="">
New Revision: 243114<br class="">
<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D243114-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=UZ4R4GeKaDvutjMYuD8IoHGEWDGG3msXyoGZ4ewAcoI&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=243114&view=rev</a><br class="">
Log:<br class="">
Remove access to the DataLayout in the TargetMachine<br class="">
<br class="">
Summary:<br class="">
Replace getDataLayout() with a createDataLayout() method to make<br class="">
explicit that it is intended to create a DataLayout only and not<br class="">
accessing it for other purpose.<br class="">
<br class="">
This change is the last of a series of commits dedicated to have a<br class="">
single DataLayout during compilation by using always the one owned<br class="">
by the module.<br class="">
<br class="">
Reviewers: echristo<br class="">
<br class="">
Subscribers: jholewinski, llvm-commits, rafael, yaron.keren<br class="">
<br class="">
Differential Revision: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D11103&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=dXWEnBfvsI03op361kwNdQlrKHVjIaqqcdoeaCoZK6w&e=" rel="noreferrer" target="_blank" class="">http://reviews.llvm.org/D11103</a><br class="">
<br class="">
(cherry picked from commit 5609fc56bca971e5a7efeaa6ca4676638eaec5ea)<br class="">
<br class="">
From: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>><br class="">
<br class="">
Modified:<br class="">
llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp<br class="">
llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp<br class="">
llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp<br class="">
llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp<br class="">
llvm/trunk/include/llvm/Target/TargetMachine.h<br class="">
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br class="">
llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp<br class="">
llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h<br class="">
llvm/trunk/lib/LTO/LTOCodeGenerator.cpp<br class="">
llvm/trunk/lib/LTO/LTOModule.cpp<br class="">
llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp<br class="">
llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp<br class="">
llvm/trunk/lib/Target/TargetMachineC.cpp<br class="">
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br class="">
llvm/trunk/tools/llc/llc.cpp<br class="">
llvm/trunk/tools/lli/OrcLazyJIT.cpp<br class="">
llvm/trunk/tools/lli/OrcLazyJIT.h<br class="">
<br class="">
Modified: llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_examples_Kaleidoscope_Orc_fully-5Flazy_toy.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=0NYI8FAmYeTpVkGd3zF3XVPkLf0zjlEpqy-8HLw7s-g&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp (original)<br class="">
+++ llvm/trunk/examples/Kaleidoscope/Orc/fully_lazy/toy.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -717,7 +717,7 @@ public:<br class="">
M(new Module(GenerateUniqueName("jit_module_"),<br class="">
Session.getLLVMContext())),<br class="">
Builder(Session.getLLVMContext()) {<br class="">
- M->setDataLayout(*Session.getTarget().getDataLayout());<br class="">
+ M->setDataLayout(Session.getTarget().createDataLayout());<br class="">
}<br class="">
<br class="">
SessionContext& getSession() { return Session; }<br class="">
@@ -1179,7 +1179,7 @@ public:<br class="">
{<br class="">
raw_string_ostream MangledNameStream(MangledName);<br class="">
Mangler::getNameWithPrefix(MangledNameStream, Name,<br class="">
- *Session.getTarget().getDataLayout());<br class="">
+ Session.getTarget().createDataLayout());<br class="">
}<br class="">
return MangledName;<br class="">
}<br class="">
<br class="">
Modified: llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_examples_Kaleidoscope_Orc_initial_toy.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=66ADMB20CzYtkZ7sIBabynp_4hI4lns5NmWOaPKc2Ag&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp (original)<br class="">
+++ llvm/trunk/examples/Kaleidoscope/Orc/initial/toy.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -716,7 +716,7 @@ public:<br class="">
M(new Module(GenerateUniqueName("jit_module_"),<br class="">
Session.getLLVMContext())),<br class="">
Builder(Session.getLLVMContext()) {<br class="">
- M->setDataLayout(*Session.getTarget().getDataLayout());<br class="">
+ M->setDataLayout(Session.getTarget().createDataLayout());<br class="">
}<br class="">
<br class="">
SessionContext& getSession() { return Session; }<br class="">
@@ -1160,7 +1160,7 @@ public:<br class="">
typedef CompileLayerT::ModuleSetHandleT ModuleHandleT;<br class="">
<br class="">
KaleidoscopeJIT(SessionContext &Session)<br class="">
- : DL(*Session.getTarget().getDataLayout()),<br class="">
+ : DL(Session.getTarget().createDataLayout()),<br class="">
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())) {}<br class="">
<br class="">
std::string mangle(const std::string &Name) {<br class="">
@@ -1201,7 +1201,7 @@ public:<br class="">
}<br class="">
<br class="">
private:<br class="">
- const DataLayout &DL;<br class="">
+ const DataLayout DL;<br class="">
ObjLayerT ObjectLayer;<br class="">
CompileLayerT CompileLayer;<br class="">
};<br class="">
<br class="">
Modified: llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_examples_Kaleidoscope_Orc_lazy-5Fcodegen_toy.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=ieuYyJtB1YIy3LHrH4gYA3pvPtg_yzf9RjbE2TqHIAU&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp (original)<br class="">
+++ llvm/trunk/examples/Kaleidoscope/Orc/lazy_codegen/toy.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -716,7 +716,7 @@ public:<br class="">
M(new Module(GenerateUniqueName("jit_module_"),<br class="">
Session.getLLVMContext())),<br class="">
Builder(Session.getLLVMContext()) {<br class="">
- M->setDataLayout(*Session.getTarget().getDataLayout());<br class="">
+ M->setDataLayout(Session.getTarget().createDataLayout());<br class="">
}<br class="">
<br class="">
SessionContext& getSession() { return Session; }<br class="">
@@ -1162,7 +1162,7 @@ public:<br class="">
typedef LazyEmitLayerT::ModuleSetHandleT ModuleHandleT;<br class="">
<br class="">
KaleidoscopeJIT(SessionContext &Session)<br class="">
- : DL(*Session.getTarget().getDataLayout()),<br class="">
+ : DL(Session.getTarget().createDataLayout()),<br class="">
CompileLayer(ObjectLayer, SimpleCompiler(Session.getTarget())),<br class="">
LazyEmitLayer(CompileLayer) {}<br class="">
<br class="">
@@ -1204,7 +1204,7 @@ public:<br class="">
}<br class="">
<br class="">
private:<br class="">
- const DataLayout &DL;<br class="">
+ const DataLayout DL;<br class="">
ObjLayerT ObjectLayer;<br class="">
CompileLayerT CompileLayer;<br class="">
LazyEmitLayerT LazyEmitLayer;<br class="">
<br class="">
Modified: llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_examples_Kaleidoscope_Orc_lazy-5Firgen_toy.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=0Cx378Yv0bO75_fTmZtK024jXP0Ww0AGTK5LoGB0-LQ&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp (original)<br class="">
+++ llvm/trunk/examples/Kaleidoscope/Orc/lazy_irgen/toy.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -716,7 +716,7 @@ public:<br class="">
M(new Module(GenerateUniqueName("jit_module_"),<br class="">
Session.getLLVMContext())),<br class="">
Builder(Session.getLLVMContext()) {<br class="">
- M->setDataLayout(*Session.getTarget().getDataLayout());<br class="">
+ M->setDataLayout(Session.getTarget().createDataLayout());<br class="">
}<br class="">
<br class="">
SessionContext& getSession() { return Session; }<br class="">
@@ -1170,7 +1170,7 @@ public:<br class="">
{<br class="">
raw_string_ostream MangledNameStream(MangledName);<br class="">
Mangler::getNameWithPrefix(MangledNameStream, Name,<br class="">
- *Session.getTarget().getDataLayout());<br class="">
+ Session.getTarget().createDataLayout());<br class="">
}<br class="">
return MangledName;<br class="">
}<br class="">
<br class="">
Modified: llvm/trunk/include/llvm/Target/TargetMachine.h<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_Target_TargetMachine.h-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=1u9xwZVDOQIJ0dfZ1TIADG-Nmah3M5VLatdVaT-hAGA&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetMachine.h?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/include/llvm/Target/TargetMachine.h (original)<br class="">
+++ llvm/trunk/include/llvm/Target/TargetMachine.h Fri Jul 24 11:04:22 2015<br class="">
@@ -76,7 +76,12 @@ protected: // Can only create subclasses<br class="">
/// The Target that this machine was created for.<br class="">
const Target &TheTarget;<br class="">
<br class="">
- /// For ABI type size and alignment.<br class="">
+ /// DataLayout for the target: keep ABI type size and alignment.<br class="">
+ ///<br class="">
+ /// The DataLayout is created based on the string representation provided<br class="">
+ /// during construction. It is kept here only to avoid reparsing the string<br class="">
+ /// but should not really be used during compilation, because it has an<br class="">
+ /// internal cache that is context specific.<br class="">
const DataLayout DL;<br class="">
<br class="">
/// Triple string, CPU name, and target feature strings the TargetMachine<br class="">
@@ -125,9 +130,13 @@ public:<br class="">
return *static_cast<const STC*>(getSubtargetImpl(F));<br class="">
}<br class="">
<br class="">
- /// This method returns a pointer to the DataLayout for the target. It should<br class="">
- /// be unchanging for every subtarget.<br class="">
- const DataLayout *getDataLayout() const { return &DL; }<br class="">
+ /// Create a DataLayout.<br class="">
+ const DataLayout createDataLayout() const { return DL; }<br class="">
+<br class="">
+ /// Get the pointer size for this target.<br class="">
+ ///<br class="">
+ /// This is the only time the DataLayout in the TargetMachine is used.<br class="">
+ unsigned getPointerSize() const { return DL.getPointerSize(); }<br class="">
<br class="">
/// \brief Reset the target options based on the function's attributes.<br class="">
// FIXME: Remove TargetOptions that affect per-function code generation<br class="">
<br class="">
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_AsmPrinter.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=kMdlS4_So4F1wMhtAjm2FMfC85Jro_3lXuXfuPOCbXQ&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)<br class="">
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -139,9 +139,9 @@ const DataLayout &AsmPrinter::getDataLay<br class="">
return MMI->getModule()->getDataLayout();<br class="">
}<br class="">
<br class="">
-unsigned AsmPrinter::getPointerSize() const {<br class="">
- return TM.getDataLayout()->getPointerSize();<br class="">
-}<br class="">
+// Do not use the cached DataLayout because some client use it without a Module<br class="">
+// (llmv-dsymutil, llvm-dwarfdump).<br class="">
+unsigned AsmPrinter::getPointerSize() const { return TM.getPointerSize(); }<br class="">
<br class="">
const MCSubtargetInfo &AsmPrinter::getSubtargetInfo() const {<br class="">
assert(MF && "getSubtargetInfo requires a valid MachineFunction!");<br class="">
<br class="">
Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_ExecutionEngine_MCJIT_MCJIT.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=-6MouC66YpzEHgP73A2Vs2g9re-HF4xUoH5Q6q8_VMA&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)<br class="">
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -68,7 +68,7 @@ MCJIT::createJIT(std::unique_ptr<Module><br class="">
MCJIT::MCJIT(std::unique_ptr<Module> M, std::unique_ptr<TargetMachine> TM,<br class="">
std::shared_ptr<MCJITMemoryManager> MemMgr,<br class="">
std::shared_ptr<RuntimeDyld::SymbolResolver> Resolver)<br class="">
- : ExecutionEngine(*TM->getDataLayout(), std::move(M)), TM(std::move(TM)),<br class="">
+ : ExecutionEngine(TM->createDataLayout(), std::move(M)), TM(std::move(TM)),<br class="">
Ctx(nullptr), MemMgr(std::move(MemMgr)),<br class="">
Resolver(*this, std::move(Resolver)), Dyld(*this->MemMgr, this->Resolver),<br class="">
ObjCache(nullptr) {<br class="">
<br class="">
Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_ExecutionEngine_Orc_OrcMCJITReplacement.h-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=fB1xn5olzTk1S1jhymHYoJL4cgBO6PH9pV6XD-8KBgs&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h (original)<br class="">
+++ llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h Fri Jul 24 11:04:22 2015<br class="">
@@ -140,7 +140,7 @@ public:<br class="">
std::shared_ptr<MCJITMemoryManager> MemMgr,<br class="">
std::shared_ptr<RuntimeDyld::SymbolResolver> ClientResolver,<br class="">
std::unique_ptr<TargetMachine> TM)<br class="">
- : ExecutionEngine(*TM->getDataLayout()), TM(std::move(TM)),<br class="">
+ : ExecutionEngine(TM->createDataLayout()), TM(std::move(TM)),<br class="">
MemMgr(*this, std::move(MemMgr)), Resolver(*this),<br class="">
ClientResolver(std::move(ClientResolver)), NotifyObjectLoaded(*this),<br class="">
NotifyFinalized(*this),<br class="">
<br class="">
Modified: llvm/trunk/lib/LTO/LTOCodeGenerator.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_LTO_LTOCodeGenerator.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=9aa0OQ1xzwJqFYir8cXF9a7QX8Sqpnf7f8KgnXm1gjE&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOCodeGenerator.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/LTO/LTOCodeGenerator.cpp (original)<br class="">
+++ llvm/trunk/lib/LTO/LTOCodeGenerator.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -521,7 +521,7 @@ bool LTOCodeGenerator::optimize(bool Dis<br class="">
legacy::PassManager passes;<br class="">
<br class="">
// Add an appropriate DataLayout instance for this module...<br class="">
- mergedModule->setDataLayout(*TargetMach->getDataLayout());<br class="">
+ mergedModule->setDataLayout(TargetMach->createDataLayout());<br class="">
<br class="">
passes.add(<br class="">
createTargetTransformInfoWrapperPass(TargetMach->getTargetIRAnalysis()));<br class="">
<br class="">
Modified: llvm/trunk/lib/LTO/LTOModule.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_LTO_LTOModule.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=YzY_9VvmAb5P3btGqPXqjSlJDdGVPakngaBf8smiLbs&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/LTOModule.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/LTO/LTOModule.cpp (original)<br class="">
+++ llvm/trunk/lib/LTO/LTOModule.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -232,7 +232,7 @@ LTOModule *LTOModule::makeLTOModule(Memo<br class="">
<br class="">
TargetMachine *target = march->createTargetMachine(TripleStr, CPU, FeatureStr,<br class="">
options);<br class="">
- M->setDataLayout(*target->getDataLayout());<br class="">
+ M->setDataLayout(target->createDataLayout());<br class="">
<br class="">
std::unique_ptr<object::IRObjectFile> IRObj(<br class="">
new object::IRObjectFile(Buffer, std::move(M)));<br class="">
<br class="">
Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_Sparc_SparcISelLowering.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=yZ2j7HfvM2dpUSgwh3tYJ5ZuCezNSgVCBvdzFlU9cJs&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original)<br class="">
+++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -1370,7 +1370,7 @@ static SPCC::CondCodes FPCondCCodeToFCC(<br class="">
SparcTargetLowering::SparcTargetLowering(TargetMachine &TM,<br class="">
const SparcSubtarget &STI)<br class="">
: TargetLowering(TM), Subtarget(&STI) {<br class="">
- auto &DL = *TM.getDataLayout();<br class="">
+ MVT PtrVT = MVT::getIntegerVT(8 * TM.getPointerSize());<br class="">
<br class="">
// Set up the register classes.<br class="">
addRegisterClass(MVT::i32, &SP::IntRegsRegClass);<br class="">
@@ -1396,10 +1396,10 @@ SparcTargetLowering::SparcTargetLowering<br class="">
setTruncStoreAction(MVT::f128, MVT::f64, Expand);<br class="">
<br class="">
// Custom legalize GlobalAddress nodes into LO/HI parts.<br class="">
- setOperationAction(ISD::GlobalAddress, getPointerTy(DL), Custom);<br class="">
- setOperationAction(ISD::GlobalTLSAddress, getPointerTy(DL), Custom);<br class="">
- setOperationAction(ISD::ConstantPool, getPointerTy(DL), Custom);<br class="">
- setOperationAction(ISD::BlockAddress, getPointerTy(DL), Custom);<br class="">
+ setOperationAction(ISD::GlobalAddress, PtrVT, Custom);<br class="">
+ setOperationAction(ISD::GlobalTLSAddress, PtrVT, Custom);<br class="">
+ setOperationAction(ISD::ConstantPool, PtrVT, Custom);<br class="">
+ setOperationAction(ISD::BlockAddress, PtrVT, Custom);<br class="">
<br class="">
// Sparc doesn't have sext_inreg, replace them with shl/sra<br class="">
setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i16, Expand);<br class="">
<br class="">
Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_SystemZ_SystemZISelLowering.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=q41fdZv8cavNS1OBeRfdBXVyxJvjbpsNhUHC0qmyK0s&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original)<br class="">
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -84,8 +84,7 @@ static MachineOperand earlyUseOperand(Ma<br class="">
SystemZTargetLowering::SystemZTargetLowering(const TargetMachine &TM,<br class="">
const SystemZSubtarget &STI)<br class="">
: TargetLowering(TM), Subtarget(STI) {<br class="">
- auto &DL = *TM.getDataLayout();<br class="">
- MVT PtrVT = getPointerTy(DL);<br class="">
+ MVT PtrVT = MVT::getIntegerVT(8 * TM.getPointerSize());<br class="">
<br class="">
// Set up the register classes.<br class="">
if (Subtarget.hasHighWord())<br class="">
<br class="">
Modified: llvm/trunk/lib/Target/TargetMachineC.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_TargetMachineC.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=kPc1e9aGoof6j18Y7GOtHebBzt-QPd0dcABX-9k5VwE&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachineC.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/Target/TargetMachineC.cpp (original)<br class="">
+++ llvm/trunk/lib/Target/TargetMachineC.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -32,15 +32,25 @@<br class="">
<br class="">
using namespace llvm;<br class="">
<br class="">
+<br class="">
+// The TargetMachine uses to offer access to a DataLayout member. This is reflected<br class="">
+// in the C API. For backward compatibility reason, this structure allows to keep<br class="">
+// a DataLayout member accessible to C client that have a handle to a<br class="">
+// LLVMTargetMachineRef.<br class="">
+struct LLVMOpaqueTargetMachine {<br class="">
+ std::unique_ptr<TargetMachine> Machine;<br class="">
+ DataLayout DL;<br class="">
+};<br class="">
+<br class="">
+<br class="">
inline TargetMachine *unwrap(LLVMTargetMachineRef P) {<br class="">
- return reinterpret_cast<TargetMachine*>(P);<br class="">
+ return P->Machine.get();<br class="">
}<br class="">
inline Target *unwrap(LLVMTargetRef P) {<br class="">
return reinterpret_cast<Target*>(P);<br class="">
}<br class="">
inline LLVMTargetMachineRef wrap(const TargetMachine *P) {<br class="">
- return<br class="">
- reinterpret_cast<LLVMTargetMachineRef>(const_cast<TargetMachine*>(P));<br class="">
+ return new LLVMOpaqueTargetMachine{ std::unique_ptr<TargetMachine>(const_cast<TargetMachine*>(P)), P->createDataLayout() };<br class="">
}<br class="">
inline LLVMTargetRef wrap(const Target * P) {<br class="">
return reinterpret_cast<LLVMTargetRef>(const_cast<Target*>(P));<br class="">
@@ -147,7 +157,7 @@ LLVMTargetMachineRef LLVMCreateTargetMac<br class="">
<br class="">
<br class="">
void LLVMDisposeTargetMachine(LLVMTargetMachineRef T) {<br class="">
- delete unwrap(T);<br class="">
+ delete T;<br class="">
}<br class="">
<br class="">
LLVMTargetRef LLVMGetTargetMachineTarget(LLVMTargetMachineRef T) {<br class="">
@@ -170,8 +180,9 @@ char* LLVMGetTargetMachineFeatureString(<br class="">
return strdup(StringRep.c_str());<br class="">
}<br class="">
<br class="">
+/// @deprecated: see "struct LLVMOpaqueTargetMachine" description above<br class="">
LLVMTargetDataRef LLVMGetTargetMachineData(LLVMTargetMachineRef T) {<br class="">
- return wrap(unwrap(T)->getDataLayout());<br class="">
+ return wrap(&T->DL);<br class="">
}<br class="">
<br class="">
void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,<br class="">
@@ -190,14 +201,7 @@ static LLVMBool LLVMTargetMachineEmit(LL<br class="">
<br class="">
std::string error;<br class="">
<br class="">
- const DataLayout *td = TM->getDataLayout();<br class="">
-<br class="">
- if (!td) {<br class="">
- error = "No DataLayout in TargetMachine";<br class="">
- *ErrorMessage = strdup(error.c_str());<br class="">
- return true;<br class="">
- }<br class="">
- Mod->setDataLayout(*td);<br class="">
+ Mod->setDataLayout(TM->createDataLayout());<br class="">
<br class="">
TargetMachine::CodeGenFileType ft;<br class="">
switch (codegen) {<br class="">
<br class="">
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_X86_X86ISelLowering.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=gIbWaUFuXJ94vX_qSGHDzbUk8tZjpQfuGCL_EPpCmLU&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)<br class="">
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -76,7 +76,7 @@ X86TargetLowering::X86TargetLowering(con<br class="">
: TargetLowering(TM), Subtarget(&STI) {<br class="">
X86ScalarSSEf64 = Subtarget->hasSSE2();<br class="">
X86ScalarSSEf32 = Subtarget->hasSSE1();<br class="">
- TD = TM.getDataLayout();<br class="">
+ MVT PtrVT = MVT::getIntegerVT(8 * TM.getPointerSize());<br class="">
<br class="">
// Set up the TargetLowering object.<br class="">
static const MVT IntVTs[] = { MVT::i8, MVT::i16, MVT::i32, MVT::i64 };<br class="">
@@ -505,7 +505,7 @@ X86TargetLowering::X86TargetLowering(con<br class="">
setOperationAction(ISD::STACKSAVE, MVT::Other, Expand);<br class="">
setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand);<br class="">
<br class="">
- setOperationAction(ISD::DYNAMIC_STACKALLOC, getPointerTy(*TD), Custom);<br class="">
+ setOperationAction(ISD::DYNAMIC_STACKALLOC, PtrVT, Custom);<br class="">
<br class="">
// GC_TRANSITION_START and GC_TRANSITION_END need custom lowering.<br class="">
setOperationAction(ISD::GC_TRANSITION_START, MVT::Other, Custom);<br class="">
@@ -16515,9 +16515,11 @@ SDValue X86TargetLowering::LowerINIT_TRA<br class="">
<br class="">
for (FunctionType::param_iterator I = FTy->param_begin(),<br class="">
E = FTy->param_end(); I != E; ++I, ++Idx)<br class="">
- if (Attrs.hasAttribute(Idx, Attribute::InReg))<br class="">
+ if (Attrs.hasAttribute(Idx, Attribute::InReg)) {<br class="">
+ auto &DL = DAG.getDataLayout();<br class="">
// FIXME: should only count parameters that are lowered to integers.<br class="">
- InRegCount += (TD->getTypeSizeInBits(*I) + 31) / 32;<br class="">
+ InRegCount += (DL.getTypeSizeInBits(*I) + 31) / 32;<br class="">
+ }<br class="">
<br class="">
if (InRegCount > 2) {<br class="">
report_fatal_error("Nest register in use - reduce number of inreg"<br class="">
<br class="">
Modified: llvm/trunk/tools/llc/llc.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_llc_llc.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=qF8oOAP3-wneFwP0sGdl7s8EjAvmZ2O_cJoveQ0d7Tg&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llc/llc.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/tools/llc/llc.cpp (original)<br class="">
+++ llvm/trunk/tools/llc/llc.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -312,8 +312,7 @@ static int compileModule(char **argv, LL<br class="">
PM.add(new TargetLibraryInfoWrapperPass(TLII));<br class="">
<br class="">
// Add the target data from the target machine, if it exists, or the module.<br class="">
- if (const DataLayout *DL = Target->getDataLayout())<br class="">
- M->setDataLayout(*DL);<br class="">
+ M->setDataLayout(Target->createDataLayout());<br class="">
<br class="">
// Override function attributes based on CPUStr, FeaturesStr, and command line<br class="">
// flags.<br class="">
<br class="">
Modified: llvm/trunk/tools/lli/OrcLazyJIT.cpp<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_lli_OrcLazyJIT.cpp-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=sh9uZIYxhHYEP5haIF_vgD0HBboYkBmOIBE-MPuKIEs&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.cpp?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/tools/lli/OrcLazyJIT.cpp (original)<br class="">
+++ llvm/trunk/tools/lli/OrcLazyJIT.cpp Fri Jul 24 11:04:22 2015<br class="">
@@ -136,7 +136,8 @@ int llvm::runOrcLazyJIT(std::unique_ptr<<br class="">
}<br class="">
<br class="">
// Everything looks good. Build the JIT.<br class="">
- OrcLazyJIT J(std::move(TM), Context, CallbackMgrBuilder);<br class="">
+ auto &DL = M->getDataLayout();<br class="">
+ OrcLazyJIT J(std::move(TM), DL, Context, CallbackMgrBuilder);<br class="">
<br class="">
// Add the module, look up main and run it.<br class="">
auto MainHandle = J.addModule(std::move(M));<br class="">
<br class="">
Modified: llvm/trunk/tools/lli/OrcLazyJIT.h<br class="">
URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_lli_OrcLazyJIT.h-3Frev-3D243114-26r1-3D243113-26r2-3D243114-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=ofvHi9knA_VDkNQA2JjtLFG3-8wAnDRcM19apYRcAW4&s=0z5BhO4ZuYb0gRXyPnDqRpof_1A-Au51btPuc4twQhU&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lli/OrcLazyJIT.h?rev=243114&r1=243113&r2=243114&view=diff</a><br class="">
==============================================================================<br class="">
--- llvm/trunk/tools/lli/OrcLazyJIT.h (original)<br class="">
+++ llvm/trunk/tools/lli/OrcLazyJIT.h Fri Jul 24 11:04:22 2015<br class="">
@@ -46,16 +46,17 @@ public:<br class="">
CallbackManagerBuilder;<br class="">
<br class="">
static CallbackManagerBuilder createCallbackManagerBuilder(Triple T);<br class="">
+ const DataLayout &DL;<br class="">
<br class="">
- OrcLazyJIT(std::unique_ptr<TargetMachine> TM, LLVMContext &Context,<br class="">
- CallbackManagerBuilder &BuildCallbackMgr)<br class="">
- : TM(std::move(TM)),<br class="">
- ObjectLayer(),<br class="">
- CompileLayer(ObjectLayer, orc::SimpleCompiler(*this->TM)),<br class="">
- IRDumpLayer(CompileLayer, createDebugDumper()),<br class="">
- CCMgr(BuildCallbackMgr(IRDumpLayer, CCMgrMemMgr, Context)),<br class="">
- CODLayer(IRDumpLayer, *CCMgr, false),<br class="">
- CXXRuntimeOverrides([this](const std::string &S) { return mangle(S); }) {}<br class="">
+ OrcLazyJIT(std::unique_ptr<TargetMachine> TM, const DataLayout &DL,<br class="">
+ LLVMContext &Context, CallbackManagerBuilder &BuildCallbackMgr)<br class="">
+ : DL(DL), TM(std::move(TM)), ObjectLayer(),<br class="">
+ CompileLayer(ObjectLayer, orc::SimpleCompiler(*this->TM)),<br class="">
+ IRDumpLayer(CompileLayer, createDebugDumper()),<br class="">
+ CCMgr(BuildCallbackMgr(IRDumpLayer, CCMgrMemMgr, Context)),<br class="">
+ CODLayer(IRDumpLayer, *CCMgr, false),<br class="">
+ CXXRuntimeOverrides(<br class="">
+ [this](const std::string &S) { return mangle(S); }) {}<br class="">
<br class="">
~OrcLazyJIT() {<br class="">
// Run any destructors registered with __cxa_atexit.<br class="">
@@ -73,7 +74,7 @@ public:<br class="">
ModuleHandleT addModule(std::unique_ptr<Module> M) {<br class="">
// Attach a data-layout if one isn't already present.<br class="">
if (M->getDataLayout().isDefault())<br class="">
- M->setDataLayout(*TM->getDataLayout());<br class="">
+ M->setDataLayout(DL);<br class="">
<br class="">
// Record the static constructors and destructors. We have to do this before<br class="">
// we hand over ownership of the module to the JIT.<br class="">
@@ -131,12 +132,11 @@ public:<br class="">
}<br class="">
<br class="">
private:<br class="">
-<br class="">
std::string mangle(const std::string &Name) {<br class="">
std::string MangledName;<br class="">
{<br class="">
raw_string_ostream MangledNameStream(MangledName);<br class="">
- Mangler::getNameWithPrefix(MangledNameStream, Name, *TM->getDataLayout());<br class="">
+ Mangler::getNameWithPrefix(MangledNameStream, Name, DL);<br class="">
}<br class="">
return MangledName;<br class="">
}<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
llvm-commits mailing list<br class="">
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank" class="">llvm-commits@cs.uiuc.edu</a><br class="">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br class="">
</blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div></div></div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div></body></html>