cargo fmt

This commit is contained in:
Luke Boswell 2023-12-12 21:15:17 +11:00
parent 4d6546f5b0
commit 1051ba6569
No known key found for this signature in database
GPG key ID: F6DB3C9DB47377B0
2 changed files with 24 additions and 13 deletions

View file

@ -38,10 +38,13 @@ pub fn call_bitcode_fn<'ctx>(
});
if env.target_info.operating_system == roc_target::OperatingSystem::Windows {
// On windows zig uses a vector type <2xi64> instead of a i128 value
// On windows zig uses a vector type <2xi64> instead of a i128 value
let vec_type = env.context.i64_type().vec_type(2);
if ret.get_type() == vec_type.into() {
return env.builder.build_bitcast(ret, env.context.i128_type(), "return_i128").unwrap()
return env
.builder
.build_bitcast(ret, env.context.i128_type(), "return_i128")
.unwrap();
}
}
@ -64,18 +67,23 @@ fn call_bitcode_fn_help<'ctx>(
args: &[BasicValueEnum<'ctx>],
fn_name: &str,
) -> CallSiteValue<'ctx> {
let it = args.iter()
.map(|x|
let it = args
.iter()
.map(|x| {
if env.target_info.operating_system == roc_target::OperatingSystem::Windows {
if x.get_type() == env.context.i128_type().into() {
let parent =
env
let parent = env
.builder
.get_insert_block()
.and_then(|b| b.get_parent())
.unwrap();
let alloca = create_entry_block_alloca(env, parent, x.get_type(), "pass_u128_by_reference");
let alloca = create_entry_block_alloca(
env,
parent,
x.get_type(),
"pass_u128_by_reference",
);
env.builder.build_store(alloca, *x).unwrap();
@ -86,7 +94,7 @@ fn call_bitcode_fn_help<'ctx>(
} else {
*x
}
)
})
.map(|x| (x).into());
let arguments = bumpalo::collections::Vec::from_iter_in(it, env.arena);

View file

@ -1099,7 +1099,7 @@ pub(crate) fn run_low_level<'a, 'ctx>(
}
NumBytesToU128 => {
arguments!(list, position);
let ret = call_list_bitcode_fn(
env,
&[list.into_struct_value()],
@ -1110,11 +1110,12 @@ pub(crate) fn run_low_level<'a, 'ctx>(
if env.target_info.operating_system == roc_target::OperatingSystem::Windows {
// On windows the return type is not a i128, likely due to alignment
env.builder.build_bitcast(ret, env.context.i128_type(), "empty_string").unwrap()
env.builder
.build_bitcast(ret, env.context.i128_type(), "empty_string")
.unwrap()
} else {
ret
}
}
NumCompare => {
arguments_with_layouts!((lhs_arg, lhs_layout), (rhs_arg, rhs_layout));
@ -2605,7 +2606,9 @@ fn build_int_unary_op<'a, 'ctx, 'env>(
}
PtrWidth::Bytes8 => {
let return_by_pointer = {
if env.target_info.operating_system == roc_target::OperatingSystem::Windows {
if env.target_info.operating_system
== roc_target::OperatingSystem::Windows
{
target_int_width.stack_size() as usize >= env.target_info.ptr_size()
} else {
target_int_width.stack_size() as usize > env.target_info.ptr_size()