mirror of
https://github.com/mii443/wasmer.git
synced 2025-08-25 01:39:26 +00:00
NFC. Use const_zero() method or free function instead of const_int(0) and const_float(0.0).
This commit is contained in:
@ -606,7 +606,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
let divisor_is_zero = self.builder.build_int_compare(
|
||||
IntPredicate::EQ,
|
||||
right,
|
||||
int_type.const_int(0, false),
|
||||
int_type.const_zero(),
|
||||
"divisor_is_zero",
|
||||
);
|
||||
let should_trap = self.builder.build_or(
|
||||
@ -631,10 +631,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
self.intrinsics.expect_i1,
|
||||
&[
|
||||
should_trap.as_basic_value_enum(),
|
||||
self.intrinsics
|
||||
.i1_ty
|
||||
.const_int(0, false)
|
||||
.as_basic_value_enum(),
|
||||
self.intrinsics.i1_ty.const_zero().as_basic_value_enum(),
|
||||
],
|
||||
"should_trap_expect",
|
||||
)
|
||||
@ -669,7 +666,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
let should_trap = self.builder.build_int_compare(
|
||||
IntPredicate::EQ,
|
||||
value,
|
||||
int_type.const_int(0, false),
|
||||
int_type.const_zero(),
|
||||
"divisor_is_zero",
|
||||
);
|
||||
|
||||
@ -679,10 +676,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
self.intrinsics.expect_i1,
|
||||
&[
|
||||
should_trap.as_basic_value_enum(),
|
||||
self.intrinsics
|
||||
.i1_ty
|
||||
.const_int(0, false)
|
||||
.as_basic_value_enum(),
|
||||
self.intrinsics.i1_ty.const_zero().as_basic_value_enum(),
|
||||
],
|
||||
"should_trap_expect",
|
||||
)
|
||||
@ -1177,7 +1171,7 @@ fn emit_stack_map<'ctx>(
|
||||
.const_int(stackmap_id as u64, false)
|
||||
.as_basic_value_enum(),
|
||||
);
|
||||
params.push(intrinsics.i32_ty.const_int(0, false).as_basic_value_enum());
|
||||
params.push(intrinsics.i32_ty.const_zero().as_basic_value_enum());
|
||||
|
||||
let locals: Vec<_> = locals.iter().map(|x| x.as_basic_value_enum()).collect();
|
||||
let mut value_semantics: Vec<ValueSemantic> =
|
||||
@ -1224,7 +1218,7 @@ fn finalize_opcode_stack_map<'ctx>(
|
||||
.i64_ty
|
||||
.const_int(stackmap_id as u64, false)
|
||||
.as_basic_value_enum(),
|
||||
intrinsics.i32_ty.const_int(0, false).as_basic_value_enum(),
|
||||
intrinsics.i32_ty.const_zero().as_basic_value_enum(),
|
||||
],
|
||||
"opcode_stack_map_end",
|
||||
);
|
||||
@ -1388,7 +1382,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
);
|
||||
let signal_mem = ctx.signal_mem();
|
||||
let iv = self.builder
|
||||
.build_store(signal_mem, self.context.i8_type().const_int(0 as u64, false));
|
||||
.build_store(signal_mem, self.context.i8_type().const_zero());
|
||||
// Any 'store' can be made volatile.
|
||||
iv.set_volatile(true).unwrap();
|
||||
finalize_opcode_stack_map(
|
||||
@ -1694,19 +1688,7 @@ impl<'ctx, 'a> LLVMFunctionCodeGenerator<'ctx, 'a> {
|
||||
self.state.push1(phi.as_basic_value());
|
||||
} else {
|
||||
let basic_ty = phi.as_basic_value().get_type();
|
||||
let placeholder_value = match basic_ty {
|
||||
BasicTypeEnum::IntType(int_ty) => {
|
||||
int_ty.const_int(0, false).as_basic_value_enum()
|
||||
}
|
||||
BasicTypeEnum::FloatType(float_ty) => {
|
||||
float_ty.const_float(0.0).as_basic_value_enum()
|
||||
}
|
||||
_ => {
|
||||
return Err(CompileError::Codegen(
|
||||
"Operator::End phi type unimplemented".to_string(),
|
||||
));
|
||||
}
|
||||
};
|
||||
let placeholder_value = const_zero(basic_ty);
|
||||
self.state.push1(placeholder_value);
|
||||
phi.as_instruction().erase_from_basic_block();
|
||||
}
|
||||
|
Reference in New Issue
Block a user