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 Jan 28, 2022
1 parent 359da4d commit 695fb1d
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 @@ -8082,11 +8082,6 @@ extern "C" void jl_init_llvm(void)

jl_ExecutionEngine = new JuliaOJIT(&jl_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 @@ -888,11 +888,19 @@ 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

JuliaOJIT::JuliaOJIT(LLVMContext *LLVMCtx)
: TM(createTargetMachine()),
DL(TM->createDataLayout()),
DL(createDataLayout(*TM)),
ObjStream(ObjBufferSV),
TSCtx(std::unique_ptr<LLVMContext>(LLVMCtx)),
#if JL_LLVM_VERSION >= 130000
Expand Down Expand Up @@ -1132,7 +1140,7 @@ void JuliaOJIT::RegisterJITEventListener(JITEventListener *L)
}
#endif

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 @@ -210,7 +210,7 @@ class JuliaOJIT {
uint64_t getGlobalValueAddress(StringRef Name);
uint64_t getFunctionAddress(StringRef Name);
StringRef getFunctionAtAddress(uint64_t Addr, jl_code_instance_t *codeinst);
DataLayout& getDataLayout();
const DataLayout& getDataLayout() const;
TargetMachine &getTargetMachine();
const Triple& getTargetTriple() const;
size_t getTotalBytes() const;
Expand Down

0 comments on commit 695fb1d

Please sign in to comment.