From a23e0f56c6e3be57487d6ee633b0bc97e4d902a6 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 16 Jun 2024 11:34:27 -0400 Subject: [PATCH] xo-jit: fix Jit::target_triple() --- include/xo/jit/KaleidoscopeJit.hpp | 4 ++++ src/jit/Jit.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/xo/jit/KaleidoscopeJit.hpp b/include/xo/jit/KaleidoscopeJit.hpp index 97f65358..f3d2ebcd 100644 --- a/include/xo/jit/KaleidoscopeJit.hpp +++ b/include/xo/jit/KaleidoscopeJit.hpp @@ -111,6 +111,10 @@ namespace xo { std::move(*data_layout)); } + const std::string & target_triple() const { + return xsession_->getTargetTriple().getTriple(); + } + const DataLayout & data_layout() const { return data_layout_; } JITDylib &getMainJITDylib() { return MainJD; } diff --git a/src/jit/Jit.cpp b/src/jit/Jit.cpp index dafbd07e..f1e00828 100644 --- a/src/jit/Jit.cpp +++ b/src/jit/Jit.cpp @@ -89,10 +89,15 @@ namespace xo { ir_pipeline_ = new IrPipeline(llvm_cx_); } /*recreate_llvm_ir_pipeline*/ + /** identifies target host/architecture for machine code. + * e.g. "x86_64-unknown-linux-gnu" + **/ const std::string & Jit::target_triple() const { // although this getter is defined, seems to be empty in practice - return llvm_module_->getTargetTriple(); + //return llvm_module_->getTargetTriple(); + + return kal_jit_->target_triple(); } std::vector