diff --git a/include/xo/jit/MachPipeline.hpp b/include/xo/jit/MachPipeline.hpp index ec7e0b4d..0dc5a6a8 100644 --- a/include/xo/jit/MachPipeline.hpp +++ b/include/xo/jit/MachPipeline.hpp @@ -57,6 +57,7 @@ namespace xo { using Expression = xo::ast::Expression; using Lambda = xo::ast::Lambda; using TypeDescr = xo::reflect::TypeDescr; + using DataLayout = llvm::DataLayout; //using ConstantInterface = xo::ast::ConstantInterface; public: @@ -64,7 +65,7 @@ namespace xo { static llvm::Expected> make_aux(); static xo::ref::rp make(); - // ----- module access ----- + // ----- access ----- llvm::Module * current_module() { return llvm_module_.get(); } ref::brw llvm_cx() { return llvm_cx_; } @@ -72,6 +73,8 @@ namespace xo { /** target triple = string describing target host for codegen **/ const std::string & target_triple() const; + /** data layout = rules for alignment/padding; specific to target host **/ + const DataLayout & data_layout() const; /** append function names defined in attached module to *p_v * * (RC 15jun2024 - this part is working) @@ -173,7 +176,7 @@ namespace xo { std::unique_ptr> llvm_toplevel_ir_builder_; /** a module (1:1 with library ?) being prepared by llvm. - * IR-level -- does not contain machine code + * IR-level -- does not contain machine coode * * - function names are unique within a module. **/ diff --git a/src/jit/MachPipeline.cpp b/src/jit/MachPipeline.cpp index e647c63f..5b3e2cba 100644 --- a/src/jit/MachPipeline.cpp +++ b/src/jit/MachPipeline.cpp @@ -17,6 +17,7 @@ namespace xo { using xo::reflect::Reflect; using xo::reflect::StructMember; using xo::reflect::TypeDescr; + using llvm::DataLayout; using std::cerr; using std::endl; @@ -106,6 +107,11 @@ namespace xo { return this->jit_->target_triple(); } + const DataLayout & + MachPipeline::data_layout() const { + return this->jit_->data_layout(); + } + std::vector MachPipeline::get_function_name_v() { std::vector retval;