Skip to content

Commit

Permalink
Try #510:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] committed Jun 26, 2019
2 parents d4634df + 70247a0 commit b3455f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
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

0 comments on commit b3455f6

Please sign in to comment.