Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cleanup in LLVM backend. #510

Merged
merged 3 commits into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions lib/llvm-backend/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,22 +849,12 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
}
Operator::F32Const { value } => {
let bits = intrinsics.i32_ty.const_int(value.bits() as u64, false);
let space =
builder.build_alloca(intrinsics.f32_ty.as_basic_type_enum(), "const_space");
let i32_space =
builder.build_pointer_cast(space, intrinsics.i32_ptr_ty, "i32_space");
builder.build_store(i32_space, bits);
let f = builder.build_load(space, "f");
let f = builder.build_bitcast(bits, intrinsics.f32_ty, "f");
state.push1(f);
}
Operator::F64Const { value } => {
let bits = intrinsics.i64_ty.const_int(value.bits(), false);
let space =
builder.build_alloca(intrinsics.f64_ty.as_basic_type_enum(), "const_space");
let i64_space =
builder.build_pointer_cast(space, intrinsics.i64_ptr_ty, "i32_space");
builder.build_store(i64_space, bits);
let f = builder.build_load(space, "f");
let f = builder.build_bitcast(bits, intrinsics.f64_ty, "f");
state.push1(f);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/llvm-backend/src/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,10 @@ impl Intrinsics {
let imported_func_ty =
context.struct_type(&[i8_ptr_ty_basic, ctx_ptr_ty.as_basic_type_enum()], false);
let sigindex_ty = i32_ty;
let rt_intrinsics_ty = void_ty;
let rt_intrinsics_ty = i8_ty;
let stack_lower_bound_ty = i8_ty;
let memory_base_ty = i8_ty;
let memory_bound_ty = void_ty;
let memory_bound_ty = i8_ty;
let internals_ty = i64_ty;
let local_function_ty = i8_ptr_ty;

Expand Down