aboutsummaryrefslogtreecommitdiff
path: root/patio-to-cranelift
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-04-05 21:36:25 +0100
committerMichael Williamson <mike@zwobble.org>2026-04-05 21:36:25 +0100
commit197ddfce216d81f57691261a931f23bbe855bdfa (patch)
tree20437cd4d6ce6e66b1663e9cd35ea873edf08e85 /patio-to-cranelift
parent9eede8a0f7a482188c0650aece13d7cc33608c7d (diff)
Extract pointer_type() on context
Diffstat (limited to 'patio-to-cranelift')
-rw-r--r--patio-to-cranelift/src/context.rs4
-rw-r--r--patio-to-cranelift/src/lib.rs3
2 files changed, 5 insertions, 2 deletions
diff --git a/patio-to-cranelift/src/context.rs b/patio-to-cranelift/src/context.rs
index a0785a77..09b08173 100644
--- a/patio-to-cranelift/src/context.rs
+++ b/patio-to-cranelift/src/context.rs
@@ -217,6 +217,10 @@ impl<'a> CompilerFunctionContext<'a> {
self.module
.declare_data_in_func(data_id, &mut self.function_builder.func)
}
+
+ pub(crate) fn pointer_type(&self) -> cranelift_codegen::ir::Type {
+ cranelift_codegen::ir::Type::triple_pointer_type(&self.target_triple)
+ }
}
pub(crate) enum Mutability {
diff --git a/patio-to-cranelift/src/lib.rs b/patio-to-cranelift/src/lib.rs
index 55ea3173..74dd4993 100644
--- a/patio-to-cranelift/src/lib.rs
+++ b/patio-to-cranelift/src/lib.rs
@@ -571,8 +571,7 @@ fn compile_data_ptr_value(
match data_ptr_value {
PatioDataPtrValue::DataElement { name } => {
let global_value = context.data_ptr(name);
- let data_ptr_type =
- cranelift::prelude::Type::triple_pointer_type(&context.target_triple);
+ let data_ptr_type = context.pointer_type();
context
.function_builder
.ins()