From 77afcea9dce89e26aa663cc86adf5d82a36f4fb7 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Tue, 2 Jul 2019 15:01:50 -0700 Subject: [PATCH] Add V128 stubs to allow LLVM backend to build again. --- lib/llvm-backend/src/code.rs | 2 ++ lib/llvm-backend/src/intrinsics.rs | 10 ++++++++++ lib/llvm-backend/src/trampolines.rs | 1 + 3 files changed, 13 insertions(+) diff --git a/lib/llvm-backend/src/code.rs b/lib/llvm-backend/src/code.rs index 1a1844e4d..31285366d 100644 --- a/lib/llvm-backend/src/code.rs +++ b/lib/llvm-backend/src/code.rs @@ -57,6 +57,7 @@ fn type_to_llvm(intrinsics: &Intrinsics, ty: Type) -> BasicTypeEnum { Type::I64 => intrinsics.i64_ty.as_basic_type_enum(), Type::F32 => intrinsics.f32_ty.as_basic_type_enum(), Type::F64 => intrinsics.f64_ty.as_basic_type_enum(), + Type::V128 => intrinsics.i128_ty.as_basic_type_enum(), } } @@ -425,6 +426,7 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { Type::I64 => intrinsics.i64_zero.as_basic_value_enum(), Type::F32 => intrinsics.f32_zero.as_basic_value_enum(), Type::F64 => intrinsics.f64_zero.as_basic_value_enum(), + Type::V128 => intrinsics.i128_zero.as_basic_value_enum(), }; let builder = self.builder.as_ref().unwrap(); diff --git a/lib/llvm-backend/src/intrinsics.rs b/lib/llvm-backend/src/intrinsics.rs index fa093cb35..c866b8207 100644 --- a/lib/llvm-backend/src/intrinsics.rs +++ b/lib/llvm-backend/src/intrinsics.rs @@ -25,6 +25,7 @@ fn type_to_llvm_ptr(intrinsics: &Intrinsics, ty: Type) -> PointerType { Type::I64 => intrinsics.i64_ptr_ty, Type::F32 => intrinsics.f32_ptr_ty, Type::F64 => intrinsics.f64_ptr_ty, + Type::V128 => intrinsics.i128_ptr_ty, } } @@ -74,6 +75,7 @@ pub struct Intrinsics { pub i16_ty: IntType, pub i32_ty: IntType, pub i64_ty: IntType, + pub i128_ty: IntType, pub f32_ty: FloatType, pub f64_ty: FloatType, @@ -81,6 +83,7 @@ pub struct Intrinsics { pub i16_ptr_ty: PointerType, pub i32_ptr_ty: PointerType, pub i64_ptr_ty: PointerType, + pub i128_ptr_ty: PointerType, pub f32_ptr_ty: PointerType, pub f64_ptr_ty: PointerType, @@ -89,6 +92,7 @@ pub struct Intrinsics { pub i1_zero: IntValue, pub i32_zero: IntValue, pub i64_zero: IntValue, + pub i128_zero: IntValue, pub f32_zero: FloatValue, pub f64_zero: FloatValue, @@ -126,6 +130,7 @@ impl Intrinsics { let i16_ty = context.i16_type(); let i32_ty = context.i32_type(); let i64_ty = context.i64_type(); + let i128_ty = context.i128_type(); let f32_ty = context.f32_type(); let f64_ty = context.f64_type(); @@ -133,12 +138,14 @@ impl Intrinsics { let i16_ptr_ty = i16_ty.ptr_type(AddressSpace::Generic); let i32_ptr_ty = i32_ty.ptr_type(AddressSpace::Generic); let i64_ptr_ty = i64_ty.ptr_type(AddressSpace::Generic); + let i128_ptr_ty = i128_ty.ptr_type(AddressSpace::Generic); let f32_ptr_ty = f32_ty.ptr_type(AddressSpace::Generic); let f64_ptr_ty = f64_ty.ptr_type(AddressSpace::Generic); let i1_zero = i1_ty.const_int(0, false); let i32_zero = i32_ty.const_int(0, false); let i64_zero = i64_ty.const_int(0, false); + let i128_zero = i128_ty.const_int(0, false); let f32_zero = f32_ty.const_float(0.0); let f64_zero = f64_ty.const_float(0.0); @@ -300,6 +307,7 @@ impl Intrinsics { i16_ty, i32_ty, i64_ty, + i128_ty, f32_ty, f64_ty, @@ -307,6 +315,7 @@ impl Intrinsics { i16_ptr_ty, i32_ptr_ty, i64_ptr_ty, + i128_ptr_ty, f32_ptr_ty, f64_ptr_ty, @@ -315,6 +324,7 @@ impl Intrinsics { i1_zero, i32_zero, i64_zero, + i128_zero, f32_zero, f64_zero, diff --git a/lib/llvm-backend/src/trampolines.rs b/lib/llvm-backend/src/trampolines.rs index 23677618b..95a99223c 100644 --- a/lib/llvm-backend/src/trampolines.rs +++ b/lib/llvm-backend/src/trampolines.rs @@ -72,6 +72,7 @@ fn generate_trampoline( Type::I64 => intrinsics.i64_ptr_ty, Type::F32 => intrinsics.f32_ptr_ty, Type::F64 => intrinsics.f64_ptr_ty, + Type::V128 => intrinsics.i128_ptr_ty, }; let mut args_vec = Vec::with_capacity(func_sig.params().len() + 1);