Skip to content

Commit

Permalink
Make data_layout const
Browse files Browse the repository at this point in the history
  • Loading branch information
pchintalapudi committed Mar 3, 2022
1 parent c154c54 commit 44943c2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 10 additions & 2 deletions src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,14 @@ namespace {
#endif
return std::unique_ptr<TargetMachine>(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 {
Expand All @@ -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()),
Expand Down Expand Up @@ -1146,7 +1154,7 @@ orc::ThreadSafeContext &JuliaOJIT::getContext() {
return TSCtx;
}

DataLayout& JuliaOJIT::getDataLayout()
const DataLayout& JuliaOJIT::getDataLayout() const
{
return DL;
}
Expand Down
2 changes: 1 addition & 1 deletion src/jitlayers.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 44943c2

Please sign in to comment.