From 27d8f05b528c7ff1992d5c71d81e079a61848b96 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 26 Jun 2024 13:11:02 -0400 Subject: [PATCH] xo-jit: handle pointer types --- src/jit/MachPipeline.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/jit/MachPipeline.cpp b/src/jit/MachPipeline.cpp index e2a69e7c..69cf0d02 100644 --- a/src/jit/MachPipeline.cpp +++ b/src/jit/MachPipeline.cpp @@ -280,6 +280,22 @@ namespace xo { return llvm_struct_type; } /*struct_td_to_llvm_type*/ + llvm::PointerType * + pointer_td_to_llvm_type(xo::ref::brw llvm_cx, + TypeDescr pointer_td) + { + assert(pointer_td->is_pointer()); + + TypeDescr dest_td = pointer_td->fixed_child_td(0); + + llvm::Type * llvm_dest_type = td_to_llvm_type(llvm_cx, dest_td); + + llvm::PointerType * llvm_ptr_type + = llvm::PointerType::getUnqual(llvm_dest_type); + + return llvm_ptr_type; + } /*pointer_td_llvm_type*/ + llvm::Type * td_to_llvm_type(xo::ref::brw llvm_cx, TypeDescr td) { auto & llvm_cx_ref = llvm_cx->llvm_cx_ref(); @@ -291,6 +307,8 @@ namespace xo { return function_td_to_llvm_fnptr_type(llvm_cx, td); } else if (td->is_struct()) { return struct_td_to_llvm_type(llvm_cx, td); + } else if (td->is_pointer()) { + return pointer_td_to_llvm_type(llvm_cx, td); } else if (Reflect::is_native(td)) { return llvm::Type::getInt1Ty(llvm_cx_ref); } else if (Reflect::is_native(td)) {