fix extra ampersands

This commit is contained in:
Folkert 2021-07-29 17:32:08 +02:00
parent b6116eeb98
commit 899cbeabd7
79 changed files with 372 additions and 376 deletions

View file

@ -347,7 +347,7 @@ pub fn module_from_builtins<'ctx>(ctx: &'ctx Context, module_name: &str) -> Modu
// we compile the builtins into LLVM bitcode
let bitcode_bytes: &[u8] = include_bytes!("../../../builtins/bitcode/builtins.bc");
let memory_buffer = MemoryBuffer::create_from_memory_range(&bitcode_bytes, module_name);
let memory_buffer = MemoryBuffer::create_from_memory_range(bitcode_bytes, module_name);
let module = Module::parse_bitcode_from_buffer(&memory_buffer, ctx)
.unwrap_or_else(|err| panic!("Unable to import builtins bitcode. LLVM error: {:?}", err));
@ -632,7 +632,7 @@ pub fn float_with_precision<'a, 'ctx, 'env>(
Builtin::Decimal => call_bitcode_fn(
env,
&[env.context.f64_type().const_float(value).into()],
&bitcode::DEC_FROM_F64,
bitcode::DEC_FROM_F64,
),
Builtin::Float64 => env.context.f64_type().const_float(value).into(),
Builtin::Float32 => env.context.f32_type().const_float(value).into(),
@ -976,7 +976,7 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
// The layout of the struct expects them to be dropped!
let (field_expr, field_layout) = load_symbol_and_layout(scope, symbol);
if !field_layout.is_dropped_because_empty() {
field_types.push(basic_type_from_layout(env, &field_layout));
field_types.push(basic_type_from_layout(env, field_layout));
field_vals.push(field_expr);
}
@ -1187,7 +1187,7 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
)
}
UnionLayout::NonNullableUnwrapped(field_layouts) => {
let struct_layout = Layout::Struct(&field_layouts);
let struct_layout = Layout::Struct(field_layouts);
let struct_type = basic_type_from_layout(env, &struct_layout);
@ -1260,7 +1260,7 @@ pub fn build_exp_expr<'a, 'ctx, 'env>(
// cast the argument bytes into the desired shape for this tag
let (argument, _structure_layout) = load_symbol_and_layout(scope, structure);
get_tag_id(env, parent, &union_layout, argument).into()
get_tag_id(env, parent, union_layout, argument).into()
}
}
}
@ -1459,7 +1459,7 @@ pub fn build_tag<'a, 'ctx, 'env>(
union_layout,
tag_id,
arguments,
&tag_field_layouts,
tag_field_layouts,
tags,
reuse_allocation,
parent,
@ -1491,7 +1491,7 @@ pub fn build_tag<'a, 'ctx, 'env>(
union_layout,
tag_id,
arguments,
&tag_field_layouts,
tag_field_layouts,
tags,
reuse_allocation,
parent,
@ -2269,7 +2269,7 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
scope,
parent,
layout,
&expr,
expr,
);
// Make a new scope which includes the binding we just encountered.
@ -2399,7 +2399,7 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
cond_layout,
cond_symbol,
} => {
let ret_type = basic_type_from_layout(env, &ret_layout);
let ret_type = basic_type_from_layout(env, ret_layout);
let switch_args = SwitchArgsIr {
cond_layout: *cond_layout,
@ -2477,7 +2477,7 @@ pub fn build_exp_stmt<'a, 'ctx, 'env>(
);
// remove this join point again
scope.join_points.remove(&id);
scope.join_points.remove(id);
cont_block.move_after(phi_block).unwrap();
@ -3121,7 +3121,7 @@ where
let call_result = {
let call = builder.build_invoke(
function,
&arguments,
arguments,
then_block,
catch_block,
"call_roc_function",
@ -3291,7 +3291,7 @@ fn make_exception_catching_wrapper<'a, 'ctx, 'env>(
// Add main to the module.
let wrapper_function = add_func(
env.module,
&wrapper_function_name,
wrapper_function_name,
wrapper_function_type,
Linkage::External,
C_CALL_CONV,
@ -3414,7 +3414,7 @@ fn build_procedures_help<'a, 'ctx, 'env>(
// Add all the Proc headers to the module.
// We have to do this in a separate pass first,
// because their bodies may reference each other.
let headers = build_proc_headers(env, &mod_solutions, procedures, &mut scope);
let headers = build_proc_headers(env, mod_solutions, procedures, &mut scope);
let (_, function_pass) = construct_optimization_passes(env.module, opt_level);
@ -3428,7 +3428,7 @@ fn build_procedures_help<'a, 'ctx, 'env>(
current_scope.retain_top_level_thunks_for_module(home);
build_proc(
&env,
env,
mod_solutions,
&mut layout_ids,
func_spec_solutions,
@ -3441,7 +3441,7 @@ fn build_procedures_help<'a, 'ctx, 'env>(
env.dibuilder.finalize();
if fn_val.verify(true) {
function_pass.run_on(&fn_val);
function_pass.run_on(fn_val);
} else {
let mode = "NON-OPTIMIZED";
@ -3511,7 +3511,7 @@ fn build_proc_header<'a, 'ctx, 'env>(
let mut arg_basic_types = Vec::with_capacity_in(args.len(), arena);
for (layout, _) in args.iter() {
let arg_type = basic_type_from_layout(env, &layout);
let arg_type = basic_type_from_layout(env, layout);
arg_basic_types.push(arg_type);
}
@ -5426,7 +5426,7 @@ fn build_int_binop<'a, 'ctx, 'env>(
}
}
NumDivUnchecked => bd.build_int_signed_div(lhs, rhs, "div_int").into(),
NumPowInt => call_bitcode_fn(env, &[lhs.into(), rhs.into()], &bitcode::NUM_POW_INT),
NumPowInt => call_bitcode_fn(env, &[lhs.into(), rhs.into()], bitcode::NUM_POW_INT),
NumBitwiseAnd => bd.build_and(lhs, rhs, "int_bitwise_and").into(),
NumBitwiseXor => bd.build_xor(lhs, rhs, "int_bitwise_xor").into(),
NumBitwiseOr => bd.build_or(lhs, rhs, "int_bitwise_or").into(),
@ -5523,7 +5523,7 @@ fn build_float_binop<'a, 'ctx, 'env>(
let result = bd.build_float_add(lhs, rhs, "add_float");
let is_finite =
call_bitcode_fn(env, &[result.into()], &bitcode::NUM_IS_FINITE).into_int_value();
call_bitcode_fn(env, &[result.into()], bitcode::NUM_IS_FINITE).into_int_value();
let then_block = context.append_basic_block(parent, "then_block");
let throw_block = context.append_basic_block(parent, "throw_block");
@ -5544,7 +5544,7 @@ fn build_float_binop<'a, 'ctx, 'env>(
let result = bd.build_float_add(lhs, rhs, "add_float");
let is_finite =
call_bitcode_fn(env, &[result.into()], &bitcode::NUM_IS_FINITE).into_int_value();
call_bitcode_fn(env, &[result.into()], bitcode::NUM_IS_FINITE).into_int_value();
let is_infinite = bd.build_not(is_finite, "negate");
let struct_type = context.struct_type(
@ -5572,7 +5572,7 @@ fn build_float_binop<'a, 'ctx, 'env>(
let result = bd.build_float_sub(lhs, rhs, "sub_float");
let is_finite =
call_bitcode_fn(env, &[result.into()], &bitcode::NUM_IS_FINITE).into_int_value();
call_bitcode_fn(env, &[result.into()], bitcode::NUM_IS_FINITE).into_int_value();
let then_block = context.append_basic_block(parent, "then_block");
let throw_block = context.append_basic_block(parent, "throw_block");
@ -5593,7 +5593,7 @@ fn build_float_binop<'a, 'ctx, 'env>(
let result = bd.build_float_sub(lhs, rhs, "sub_float");
let is_finite =
call_bitcode_fn(env, &[result.into()], &bitcode::NUM_IS_FINITE).into_int_value();
call_bitcode_fn(env, &[result.into()], bitcode::NUM_IS_FINITE).into_int_value();
let is_infinite = bd.build_not(is_finite, "negate");
let struct_type = context.struct_type(
@ -5621,7 +5621,7 @@ fn build_float_binop<'a, 'ctx, 'env>(
let result = bd.build_float_mul(lhs, rhs, "mul_float");
let is_finite =
call_bitcode_fn(env, &[result.into()], &bitcode::NUM_IS_FINITE).into_int_value();
call_bitcode_fn(env, &[result.into()], bitcode::NUM_IS_FINITE).into_int_value();
let then_block = context.append_basic_block(parent, "then_block");
let throw_block = context.append_basic_block(parent, "throw_block");
@ -5642,7 +5642,7 @@ fn build_float_binop<'a, 'ctx, 'env>(
let result = bd.build_float_mul(lhs, rhs, "mul_float");
let is_finite =
call_bitcode_fn(env, &[result.into()], &bitcode::NUM_IS_FINITE).into_int_value();
call_bitcode_fn(env, &[result.into()], bitcode::NUM_IS_FINITE).into_int_value();
let is_infinite = bd.build_not(is_finite, "negate");
let struct_type = context.struct_type(
@ -5688,9 +5688,9 @@ fn build_dec_binop<'a, 'ctx, 'env>(
use roc_module::low_level::LowLevel::*;
match op {
NumAddChecked => call_bitcode_fn(env, &[lhs, rhs], &bitcode::DEC_ADD_WITH_OVERFLOW),
NumSubChecked => call_bitcode_fn(env, &[lhs, rhs], &bitcode::DEC_SUB_WITH_OVERFLOW),
NumMulChecked => call_bitcode_fn(env, &[lhs, rhs], &bitcode::DEC_MUL_WITH_OVERFLOW),
NumAddChecked => call_bitcode_fn(env, &[lhs, rhs], bitcode::DEC_ADD_WITH_OVERFLOW),
NumSubChecked => call_bitcode_fn(env, &[lhs, rhs], bitcode::DEC_SUB_WITH_OVERFLOW),
NumMulChecked => call_bitcode_fn(env, &[lhs, rhs], bitcode::DEC_MUL_WITH_OVERFLOW),
NumAdd => build_dec_binop_throw_on_overflow(
env,
parent,
@ -5715,7 +5715,7 @@ fn build_dec_binop<'a, 'ctx, 'env>(
rhs,
"decimal multiplication overflowed",
),
NumDivUnchecked => call_bitcode_fn(env, &[lhs, rhs], &bitcode::DEC_DIV),
NumDivUnchecked => call_bitcode_fn(env, &[lhs, rhs], bitcode::DEC_DIV),
_ => {
unreachable!("Unrecognized int binary operation: {:?}", op);
}
@ -5938,10 +5938,10 @@ fn build_float_unary_op<'a, 'ctx, 'env>(
env.context.i64_type(),
"num_floor",
),
NumIsFinite => call_bitcode_fn(env, &[arg.into()], &bitcode::NUM_IS_FINITE),
NumAtan => call_bitcode_fn(env, &[arg.into()], &bitcode::NUM_ATAN),
NumAcos => call_bitcode_fn(env, &[arg.into()], &bitcode::NUM_ACOS),
NumAsin => call_bitcode_fn(env, &[arg.into()], &bitcode::NUM_ASIN),
NumIsFinite => call_bitcode_fn(env, &[arg.into()], bitcode::NUM_IS_FINITE),
NumAtan => call_bitcode_fn(env, &[arg.into()], bitcode::NUM_ATAN),
NumAcos => call_bitcode_fn(env, &[arg.into()], bitcode::NUM_ACOS),
NumAsin => call_bitcode_fn(env, &[arg.into()], bitcode::NUM_ASIN),
_ => {
unreachable!("Unrecognized int unary operation: {:?}", op);
}
@ -6107,7 +6107,7 @@ fn cxa_allocate_exception<'a, 'ctx, 'env>(
let context = env.context;
let u8_ptr = context.i8_type().ptr_type(AddressSpace::Generic);
let function = match module.get_function(&name) {
let function = match module.get_function(name) {
Some(gvalue) => gvalue,
None => {
// void *__cxa_allocate_exception(size_t thrown_size);
@ -6141,7 +6141,7 @@ fn cxa_throw_exception<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>, info: BasicVal
let u8_ptr = context.i8_type().ptr_type(AddressSpace::Generic);
let function = match module.get_function(&name) {
let function = match module.get_function(name) {
Some(value) => value,
None => {
// void __cxa_throw (void *thrown_exception, std::type_info *tinfo, void (*dest) (void *) );
@ -6207,7 +6207,7 @@ fn get_gxx_personality_v0<'a, 'ctx, 'env>(env: &Env<'a, 'ctx, 'env>) -> Function
let module = env.module;
let context = env.context;
match module.get_function(&name) {
match module.get_function(name) {
Some(gvalue) => gvalue,
None => {
let personality_func = add_func(
@ -6229,7 +6229,7 @@ fn cxa_end_catch(env: &Env<'_, '_, '_>) {
let module = env.module;
let context = env.context;
let function = match module.get_function(&name) {
let function = match module.get_function(name) {
Some(gvalue) => gvalue,
None => {
let cxa_end_catch = add_func(
@ -6257,7 +6257,7 @@ fn cxa_begin_catch<'a, 'ctx, 'env>(
let module = env.module;
let context = env.context;
let function = match module.get_function(&name) {
let function = match module.get_function(name) {
Some(gvalue) => gvalue,
None => {
let u8_ptr = context.i8_type().ptr_type(AddressSpace::Generic);