diff --git a/src/Makefile b/src/Makefile index b673dda90116c..ea3fa34da29b5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -297,6 +297,7 @@ $(BUILDDIR)/jltypes.o $(BUILDDIR)/jltypes.dbg.obj: $(SRCDIR)/builtin_proto.h $(build_shlibdir)/libllvmcalltest.$(SHLIB_EXT): $(SRCDIR)/codegen_shared.h $(BUILDDIR)/julia_version.h $(BUILDDIR)/llvm-alloc-helpers.o $(BUILDDIR)/llvm-alloc-helpers.dbg.obj: $(SRCDIR)/codegen_shared.h $(SRCDIR)/llvm-pass-helpers.h $(SRCDIR)/llvm-alloc-helpers.h $(BUILDDIR)/llvm-alloc-opt.o $(BUILDDIR)/llvm-alloc-opt.dbg.obj: $(SRCDIR)/codegen_shared.h $(SRCDIR)/llvm-pass-helpers.h $(SRCDIR)/llvm-alloc-helpers.h +$(BUILDDIR)/llvm-cpufeatures.o $(BUILDDIR)/llvm-cpufeatures.dbg.obj: $(SRCDIR)/jitlayers.h $(BUILDDIR)/llvm-final-gc-lowering.o $(BUILDDIR)/llvm-final-gc-lowering.dbg.obj: $(SRCDIR)/llvm-pass-helpers.h $(BUILDDIR)/llvm-gc-invariant-verifier.o $(BUILDDIR)/llvm-gc-invariant-verifier.dbg.obj: $(SRCDIR)/codegen_shared.h $(BUILDDIR)/llvm-julia-licm.o $(BUILDDIR)/llvm-julia-licm.dbg.obj: $(SRCDIR)/codegen_shared.h $(SRCDIR)/llvm-alloc-helpers.h $(SRCDIR)/llvm-pass-helpers.h diff --git a/src/codegen.cpp b/src/codegen.cpp index 6fcafae71dc7d..e62078f70add6 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -8229,11 +8229,6 @@ extern "C" void jl_init_llvm(void) jl_ExecutionEngine = new JuliaOJIT(new LLVMContext()); - // Mark our address spaces as non-integral - auto &jl_data_layout = jl_ExecutionEngine->getDataLayout(); - std::string DL = jl_data_layout.getStringRepresentation() + "-ni:10:11:12:13"; - jl_data_layout.reset(DL); - // Register GDB event listener #if defined(JL_DEBUG_BUILD) jl_using_gdb_jitevents = 1; diff --git a/src/jitlayers.cpp b/src/jitlayers.cpp index bd4c5f110393f..6cdd07fda83de 100644 --- a/src/jitlayers.cpp +++ b/src/jitlayers.cpp @@ -876,6 +876,14 @@ namespace { #endif return std::unique_ptr(TM); } + + llvm::DataLayout createDataLayout(TargetMachine &TM) { + // Mark our address spaces as non-integral + auto jl_data_layout = TM.createDataLayout(); + std::string DL = jl_data_layout.getStringRepresentation() + "-ni:10:11:12:13"; + jl_data_layout.reset(DL); + return jl_data_layout; + } } // namespace namespace { @@ -892,7 +900,7 @@ namespace { JuliaOJIT::JuliaOJIT(LLVMContext *LLVMCtx) : TM(createTargetMachine()), - DL(TM->createDataLayout()), + DL(createDataLayout(*TM)), TMs{ cantFail(createJTMBFromTM(*TM, 0).createTargetMachine()), cantFail(createJTMBFromTM(*TM, 1).createTargetMachine()), @@ -1146,7 +1154,7 @@ orc::ThreadSafeContext &JuliaOJIT::getContext() { return TSCtx; } -DataLayout& JuliaOJIT::getDataLayout() +const DataLayout& JuliaOJIT::getDataLayout() const { return DL; } diff --git a/src/jitlayers.h b/src/jitlayers.h index 803a0d85a5a30..dcc77a8ee2795 100644 --- a/src/jitlayers.h +++ b/src/jitlayers.h @@ -234,7 +234,7 @@ class JuliaOJIT { uint64_t getFunctionAddress(StringRef Name); StringRef getFunctionAtAddress(uint64_t Addr, jl_code_instance_t *codeinst); orc::ThreadSafeContext &getContext(); - DataLayout& getDataLayout(); + const DataLayout& getDataLayout() const; TargetMachine &getTargetMachine(); const Triple& getTargetTriple() const; size_t getTotalBytes() const;