mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
use updated llvm type signatures
This commit is contained in:
parent
8738c95d6f
commit
7311c565f1
2 changed files with 35 additions and 27 deletions
|
@ -1941,8 +1941,12 @@ fn tag_pointer_set_tag_id<'ctx>(
|
|||
|
||||
// NOTE: assumes the lower bits of `cast_pointer` are all 0
|
||||
let indexed_pointer = unsafe {
|
||||
env.builder
|
||||
.build_in_bounds_gep(cast_pointer, &[tag_id_intval], "indexed_pointer")
|
||||
env.builder.new_build_in_bounds_gep(
|
||||
env.context.i8_type(),
|
||||
cast_pointer,
|
||||
&[tag_id_intval],
|
||||
"indexed_pointer",
|
||||
)
|
||||
};
|
||||
|
||||
env.builder
|
||||
|
@ -1994,7 +1998,14 @@ pub fn tag_pointer_clear_tag_id<'ctx>(
|
|||
"cast_to_i8_ptr",
|
||||
);
|
||||
|
||||
let indexed_pointer = unsafe { env.builder.build_gep(cast_pointer, &[index], "new_ptr") };
|
||||
let indexed_pointer = unsafe {
|
||||
env.builder.new_build_in_bounds_gep(
|
||||
env.context.i8_type(),
|
||||
cast_pointer,
|
||||
&[index],
|
||||
"new_ptr",
|
||||
)
|
||||
};
|
||||
|
||||
env.builder
|
||||
.build_pointer_cast(indexed_pointer, pointer.get_type(), "cast_from_i8_ptr")
|
||||
|
@ -3954,11 +3965,9 @@ fn expose_function_to_host_help_c_abi_gen_test<'a, 'ctx>(
|
|||
arguments_for_call.push(*arg);
|
||||
} else {
|
||||
match layout_interner.get_repr(*layout) {
|
||||
LayoutRepr::Builtin(Builtin::List(_)) => {
|
||||
let list_type = arg_type
|
||||
.into_pointer_type()
|
||||
.get_element_type()
|
||||
.into_struct_type();
|
||||
repr @ LayoutRepr::Builtin(Builtin::List(_)) => {
|
||||
let list_type = basic_type_from_layout(env, layout_interner, repr);
|
||||
|
||||
let loaded = env.builder.new_build_load(
|
||||
list_type,
|
||||
arg.into_pointer_value(),
|
||||
|
|
|
@ -92,7 +92,15 @@ impl<'ctx> RocStruct<'ctx> {
|
|||
index_struct_value(env, layout_interner, field_layouts, *argument, index)
|
||||
}
|
||||
(Self::ByReference(ptr), LayoutRepr::Struct(field_layouts)) => {
|
||||
index_struct_ptr(env, layout_interner, field_layouts, *ptr, index)
|
||||
let struct_type = basic_type_from_layout(env, layout_interner, struct_layout);
|
||||
index_struct_ptr(
|
||||
env,
|
||||
layout_interner,
|
||||
struct_type.into_struct_type(),
|
||||
field_layouts,
|
||||
*ptr,
|
||||
index,
|
||||
)
|
||||
}
|
||||
(other, layout) => {
|
||||
unreachable!(
|
||||
|
@ -135,26 +143,26 @@ fn index_struct_value<'a, 'ctx>(
|
|||
fn index_struct_ptr<'a, 'ctx>(
|
||||
env: &Env<'a, 'ctx, '_>,
|
||||
layout_interner: &STLayoutInterner<'a>,
|
||||
struct_type: StructType<'ctx>,
|
||||
field_layouts: &[InLayout<'a>],
|
||||
ptr: PointerValue<'ctx>,
|
||||
index: u64,
|
||||
) -> BasicValueEnum<'ctx> {
|
||||
debug_assert!(!field_layouts.is_empty());
|
||||
|
||||
let field_value = get_field_from_ptr(
|
||||
env,
|
||||
ptr,
|
||||
index as _,
|
||||
env.arena
|
||||
.alloc(format!("struct_field_access_record_{}", index)),
|
||||
);
|
||||
|
||||
let field_layout = field_layouts[index as usize];
|
||||
let field_repr = layout_interner.get_repr(field_layout);
|
||||
|
||||
let name = format!("struct_field_access_record_{}", index);
|
||||
let field_value = env
|
||||
.builder
|
||||
.new_build_struct_gep(struct_type, ptr, index as u32, &name)
|
||||
.unwrap();
|
||||
|
||||
load_roc_value(
|
||||
env,
|
||||
layout_interner,
|
||||
layout_interner.get_repr(field_layout),
|
||||
field_repr,
|
||||
field_value,
|
||||
"struct_field",
|
||||
)
|
||||
|
@ -171,15 +179,6 @@ fn get_field_from_value<'ctx>(
|
|||
.unwrap()
|
||||
}
|
||||
|
||||
fn get_field_from_ptr<'ctx>(
|
||||
env: &Env<'_, 'ctx, '_>,
|
||||
ptr: PointerValue<'ctx>,
|
||||
index: u32,
|
||||
name: &str,
|
||||
) -> PointerValue<'ctx> {
|
||||
env.builder.build_struct_gep(ptr, index, name).unwrap()
|
||||
}
|
||||
|
||||
struct BuildStruct<'ctx> {
|
||||
struct_type: StructType<'ctx>,
|
||||
struct_val: StructValue<'ctx>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue