From d0977e3e2a5b15229df46d98d48e31b290aa68da Mon Sep 17 00:00:00 2001 From: Robert Zakrzewski Date: Wed, 10 Apr 2024 23:08:01 +0200 Subject: [PATCH 01/12] Add support for Float16, Float32, Float64 and Float128 Upgrade libgccjit.version Limit new Floatxx types to master branch only apply rustfmt Make new types available only when requested Make new types available only when requested Check if Float16 and Float128 are supported by the target platform Replace Float with Float32 and Double with Float64 if target dependent type is defined Add support for Float16|32|64|128 in the builder Fix cargo fmt errors Update gccjit wrapper update hash of ligccjit --- Cargo.lock | 8 +++--- libgccjit.version | 2 +- src/builder.rs | 18 ++++++++++++ src/type_.rs | 70 +++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 90 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ab2c7ca8a47..2ce9eb081ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -79,16 +79,16 @@ dependencies = [ [[package]] name = "gccjit" -version = "1.0.0" -source = "git+https://github.com/antoyo/gccjit.rs#9f8f67edc006d543b17529a001803ffece48349e" +version = "2.0.0" +source = "git+https://github.com/antoyo/gccjit.rs#f1545d7c2c13e42d78eaac8032d49ab8f7d43b6e" dependencies = [ "gccjit_sys", ] [[package]] name = "gccjit_sys" -version = "0.0.1" -source = "git+https://github.com/antoyo/gccjit.rs#9f8f67edc006d543b17529a001803ffece48349e" +version = "0.1.0" +source = "git+https://github.com/antoyo/gccjit.rs#f1545d7c2c13e42d78eaac8032d49ab8f7d43b6e" dependencies = [ "libc", ] diff --git a/libgccjit.version b/libgccjit.version index 41bec6df5d9..adf9b64c826 100644 --- a/libgccjit.version +++ b/libgccjit.version @@ -1 +1 @@ -b6f163f52 +ac1853f579dbfdc53f2c22317e673ae99686eca2 diff --git a/src/builder.rs b/src/builder.rs index e9c16a0e4a7..30343f2e17b 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -748,6 +748,24 @@ fn frem(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { // FIXME(antoyo): this seems to produce the wrong result. return self.context.new_call(self.location, fmodf, &[a, b]); } + + #[cfg(feature = "master")] + match self.cx.type_kind(a_type) { + TypeKind::Half | TypeKind::Float => { + let fmodf = self.context.get_builtin_function("fmodf"); + return self.context.new_call(self.location, fmodf, &[a, b]); + } + TypeKind::Double => { + let fmod = self.context.get_builtin_function("fmod"); + return self.context.new_call(self.location, fmod, &[a, b]); + } + TypeKind::FP128 => { + let fmodl = self.context.get_builtin_function("fmodl"); + return self.context.new_call(self.location, fmodl, &[a, b]); + } + _ => (), + } + if let Some(vector_type) = a_type_unqualified.dyncast_vector() { assert_eq!(a_type_unqualified, b.get_type().unqualified()); diff --git a/src/type_.rs b/src/type_.rs index d0d3c21f0cf..cc26f306d6d 100644 --- a/src/type_.rs +++ b/src/type_.rs @@ -1,4 +1,6 @@ -use gccjit::{RValue, Struct, Type}; +use std::convert::TryInto; + +use gccjit::{CType, RValue, Struct, Type}; use rustc_codegen_ssa::common::TypeKind; use rustc_codegen_ssa::traits::{BaseTypeMethods, DerivedTypeMethods, TypeMembershipMethods}; use rustc_middle::ty::layout::TyAndLayout; @@ -120,10 +122,28 @@ fn type_isize(&self) -> Type<'gcc> { self.isize_type } + #[cfg(feature = "master")] fn type_f16(&self) -> Type<'gcc> { - unimplemented!("f16_f128") + if self.context.get_target_info().supports_target_dependent_type(CType::Float16) { + return self.context.new_c_type(CType::Float16); + } + unimplemented!("f16") } + #[cfg(not(feature = "master"))] + fn type_f16(&self) -> Type<'gcc> { + unimplemented!("f16") + } + + #[cfg(feature = "master")] + fn type_f32(&self) -> Type<'gcc> { + if self.context.get_target_info().supports_target_dependent_type(CType::Float32) { + return self.context.new_c_type(CType::Float32); + } + self.float_type + } + + #[cfg(not(feature = "master"))] fn type_f32(&self) -> Type<'gcc> { self.float_type } @@ -132,8 +152,17 @@ fn type_f64(&self) -> Type<'gcc> { self.double_type } + #[cfg(feature = "master")] fn type_f128(&self) -> Type<'gcc> { - unimplemented!("f16_f128") + if self.context.get_target_info().supports_target_dependent_type(CType::Float128) { + return self.context.new_c_type(CType::Float128); + } + unimplemented!("f128") + } + + #[cfg(not(feature = "master"))] + fn type_f128(&self) -> Type<'gcc> { + unimplemented!("f128") } fn type_func(&self, params: &[Type<'gcc>], return_type: Type<'gcc>) -> Type<'gcc> { @@ -161,6 +190,31 @@ fn type_struct(&self, fields: &[Type<'gcc>], packed: bool) -> Type<'gcc> { typ } + #[cfg(feature = "master")] + fn type_kind(&self, typ: Type<'gcc>) -> TypeKind { + if self.is_int_type_or_bool(typ) { + TypeKind::Integer + } else if typ.is_compatible_with(self.float_type) { + TypeKind::Float + } else if typ.is_compatible_with(self.double_type) { + TypeKind::Double + } else if typ.is_vector() { + TypeKind::Vector + } else if typ.is_floating_point() { + match typ.get_size() { + 2 => TypeKind::Half, + 4 => TypeKind::Float, + 8 => TypeKind::Double, + 16 => TypeKind::FP128, + _ => TypeKind::Void, + } + } else { + // TODO(antoyo): support other types. + TypeKind::Void + } + } + + #[cfg(not(feature = "master"))] fn type_kind(&self, typ: Type<'gcc>) -> TypeKind { if self.is_int_type_or_bool(typ) { TypeKind::Integer @@ -210,6 +264,16 @@ fn vector_length(&self, _ty: Type<'gcc>) -> usize { unimplemented!(); } + #[cfg(feature = "master")] + fn float_width(&self, typ: Type<'gcc>) -> usize { + if typ.is_floating_point() { + (typ.get_size() * u8::BITS).try_into().unwrap() + } else { + panic!("Cannot get width of float type {:?}", typ); + } + } + + #[cfg(not(feature = "master"))] fn float_width(&self, typ: Type<'gcc>) -> usize { let f32 = self.context.new_type::(); let f64 = self.context.new_type::(); From a486dbfc17945e6bad43793aae37a9ef29c05efd Mon Sep 17 00:00:00 2001 From: Robert Zakrzewski Date: Sun, 5 May 2024 18:42:27 +0200 Subject: [PATCH 02/12] Upgrade libgccjit.version --- libgccjit.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgccjit.version b/libgccjit.version index adf9b64c826..71a61a4b873 100644 --- a/libgccjit.version +++ b/libgccjit.version @@ -1 +1 @@ -ac1853f579dbfdc53f2c22317e673ae99686eca2 +272d0ccced960394fe6ff2b40b01610208cb4940 From fa18a181f7bf0a7c1f5753de82c1e934a957894d Mon Sep 17 00:00:00 2001 From: Robert Zakrzewski Date: Sun, 5 May 2024 21:03:54 +0200 Subject: [PATCH 03/12] Temporary downgrade compiler_builtins library. From version 0.1.110 the no-f16-f128 feautes introduced incompatibility --- build_system/build_sysroot/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_system/build_sysroot/Cargo.toml b/build_system/build_sysroot/Cargo.toml index 05503128f2a..d0d21a044fd 100644 --- a/build_system/build_sysroot/Cargo.toml +++ b/build_system/build_sysroot/Cargo.toml @@ -6,7 +6,8 @@ resolver = "2" [dependencies] core = { path = "./sysroot_src/library/core" } -compiler_builtins = "0.1" +# compiler_builtins = "0.1" +compiler_builtins = "=0.1.109" alloc = { path = "./sysroot_src/library/alloc" } std = { path = "./sysroot_src/library/std", features = ["panic_unwind", "backtrace"] } test = { path = "./sysroot_src/library/test" } From b94cb8c01ccb1c027dc2840483afa45c6325fd2b Mon Sep 17 00:00:00 2001 From: Robert Zakrzewski Date: Sun, 12 May 2024 17:40:14 +0200 Subject: [PATCH 04/12] Add missing types in the type_kind function reorder type_kind reorder type_kind reorder type_kind fix fix fix fix --- src/type_.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/type_.rs b/src/type_.rs index cc26f306d6d..36656c66a65 100644 --- a/src/type_.rs +++ b/src/type_.rs @@ -194,12 +194,20 @@ fn type_struct(&self, fields: &[Type<'gcc>], packed: bool) -> Type<'gcc> { fn type_kind(&self, typ: Type<'gcc>) -> TypeKind { if self.is_int_type_or_bool(typ) { TypeKind::Integer + } else if typ.get_pointee().is_some() { + TypeKind::Pointer + } else if typ.is_vector() { + TypeKind::Vector + } else if typ.dyncast_array().is_some() { + TypeKind::Array + } else if typ.is_struct().is_some() { + TypeKind::Struct + } else if typ.dyncast_function_ptr_type().is_some() { + TypeKind::Function } else if typ.is_compatible_with(self.float_type) { TypeKind::Float } else if typ.is_compatible_with(self.double_type) { TypeKind::Double - } else if typ.is_vector() { - TypeKind::Vector } else if typ.is_floating_point() { match typ.get_size() { 2 => TypeKind::Half, @@ -208,9 +216,11 @@ fn type_kind(&self, typ: Type<'gcc>) -> TypeKind { 16 => TypeKind::FP128, _ => TypeKind::Void, } + } else if typ == self.type_void() { + TypeKind::Void } else { // TODO(antoyo): support other types. - TypeKind::Void + unimplemented!(); } } From 0dad11feb9cf34f41d883f49518f9bf812314d57 Mon Sep 17 00:00:00 2001 From: Robert Zakrzewski Date: Fri, 24 May 2024 08:05:57 +0200 Subject: [PATCH 05/12] Do not use target dependent Float32 fix formatting --- src/type_.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/type_.rs b/src/type_.rs index 36656c66a65..c65301495b1 100644 --- a/src/type_.rs +++ b/src/type_.rs @@ -137,9 +137,9 @@ fn type_f16(&self) -> Type<'gcc> { #[cfg(feature = "master")] fn type_f32(&self) -> Type<'gcc> { - if self.context.get_target_info().supports_target_dependent_type(CType::Float32) { - return self.context.new_c_type(CType::Float32); - } + // if self.context.get_target_info().supports_target_dependent_type(CType::Float32) { + // return self.context.new_c_type(CType::Float32); + // } self.float_type } From c4e7c04de9bc72190ef9911c7a481ebc2a406db7 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Thu, 13 Jun 2024 08:45:41 -0400 Subject: [PATCH 06/12] Fix location of check for sized floating-point types --- src/base.rs | 19 +++++++++++++++++-- src/context.rs | 9 +++++++++ src/lib.rs | 12 ++++++++++-- src/type_.rs | 15 +++++++++------ 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/src/base.rs b/src/base.rs index 79a29a1135a..ea2b0b791b7 100644 --- a/src/base.rs +++ b/src/base.rs @@ -2,7 +2,7 @@ use std::env; use std::time::Instant; -use gccjit::{FunctionType, GlobalKind}; +use gccjit::{CType, FunctionType, GlobalKind}; use rustc_codegen_ssa::base::maybe_create_entry_wrapper; use rustc_codegen_ssa::mono_item::MonoItemExt; use rustc_codegen_ssa::traits::DebugInfoMethods; @@ -181,7 +181,22 @@ fn module_codegen( context.set_allow_unreachable_blocks(true); { - let cx = CodegenCx::new(&context, cgu, tcx, target_info.supports_128bit_int()); + // TODO: to make it less error-prone (calling get_target_info() will add the flag + // -fsyntax-only), forbid the compilation when get_target_info() is called on a + // context. + let f16_type_supported = target_info.supports_target_dependent_type(CType::Float16); + let f32_type_supported = target_info.supports_target_dependent_type(CType::Float32); + let f128_type_supported = target_info.supports_target_dependent_type(CType::Float128); + // TODO: improve this to avoid passing that many arguments. + let cx = CodegenCx::new( + &context, + cgu, + tcx, + target_info.supports_128bit_int(), + f16_type_supported, + f32_type_supported, + f128_type_supported, + ); let mono_items = cgu.items_in_deterministic_order(tcx); for &(mono_item, data) in &mono_items { diff --git a/src/context.rs b/src/context.rs index 890b4b15fc0..53a2b09217a 100644 --- a/src/context.rs +++ b/src/context.rs @@ -68,6 +68,9 @@ pub struct CodegenCx<'gcc, 'tcx> { pub sizet_type: Type<'gcc>, pub supports_128bit_integers: bool, + pub supports_f16_type: bool, + pub supports_f32_type: bool, + pub supports_f128_type: bool, pub float_type: Type<'gcc>, pub double_type: Type<'gcc>, @@ -130,6 +133,9 @@ pub fn new( codegen_unit: &'tcx CodegenUnit<'tcx>, tcx: TyCtxt<'tcx>, supports_128bit_integers: bool, + supports_f16_type: bool, + supports_f32_type: bool, + supports_f128_type: bool, ) -> Self { let check_overflow = tcx.sess.overflow_checks(); @@ -305,6 +311,9 @@ pub fn new( sizet_type, supports_128bit_integers, + supports_f16_type, + supports_f32_type, + supports_f128_type, float_type, double_type, diff --git a/src/lib.rs b/src/lib.rs index af110e3ab5e..9b9b97b9595 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,7 +89,6 @@ use std::sync::Mutex; use errors::LTONotSupported; -#[cfg(not(feature = "master"))] use gccjit::CType; use gccjit::{Context, OptimizationLevel}; #[cfg(feature = "master")] @@ -147,6 +146,10 @@ fn cpu_supports(&self, _feature: &str) -> bool { fn supports_128bit_int(&self) -> bool { self.supports_128bit_integers.load(Ordering::SeqCst) } + + fn supports_target_dependent_type(&self, _typ: CType) -> bool { + false + } } #[derive(Clone)] @@ -168,6 +171,10 @@ fn cpu_supports(&self, feature: &str) -> bool { fn supports_128bit_int(&self) -> bool { self.info.lock().expect("lock").supports_128bit_int() } + + fn supports_target_dependent_type(&self, typ: CType) -> bool { + self.info.lock().expect("lock").supports_target_dependent_type(typ) + } } #[derive(Clone)] @@ -438,7 +445,8 @@ fn run_link( pub fn __rustc_codegen_backend() -> Box { #[cfg(feature = "master")] let info = { - // Check whether the target supports 128-bit integers. + // Check whether the target supports 128-bit integers, and sized floating point types (like + // Float16). let context = Context::default(); Arc::new(Mutex::new(IntoDynSyncSend(context.get_target_info()))) }; diff --git a/src/type_.rs b/src/type_.rs index c65301495b1..7bcc71e581d 100644 --- a/src/type_.rs +++ b/src/type_.rs @@ -1,6 +1,9 @@ +#[cfg(feature = "master")] use std::convert::TryInto; -use gccjit::{CType, RValue, Struct, Type}; +#[cfg(feature = "master")] +use gccjit::CType; +use gccjit::{RValue, Struct, Type}; use rustc_codegen_ssa::common::TypeKind; use rustc_codegen_ssa::traits::{BaseTypeMethods, DerivedTypeMethods, TypeMembershipMethods}; use rustc_middle::ty::layout::TyAndLayout; @@ -124,7 +127,7 @@ fn type_isize(&self) -> Type<'gcc> { #[cfg(feature = "master")] fn type_f16(&self) -> Type<'gcc> { - if self.context.get_target_info().supports_target_dependent_type(CType::Float16) { + if self.supports_f16_type { return self.context.new_c_type(CType::Float16); } unimplemented!("f16") @@ -137,9 +140,9 @@ fn type_f16(&self) -> Type<'gcc> { #[cfg(feature = "master")] fn type_f32(&self) -> Type<'gcc> { - // if self.context.get_target_info().supports_target_dependent_type(CType::Float32) { - // return self.context.new_c_type(CType::Float32); - // } + if self.supports_f32_type { + return self.context.new_c_type(CType::Float32); + } self.float_type } @@ -154,7 +157,7 @@ fn type_f64(&self) -> Type<'gcc> { #[cfg(feature = "master")] fn type_f128(&self) -> Type<'gcc> { - if self.context.get_target_info().supports_target_dependent_type(CType::Float128) { + if self.supports_f128_type { return self.context.new_c_type(CType::Float128); } unimplemented!("f128") From 55788e4a92fee3521fa9eb1eba1bbfbe27564e9d Mon Sep 17 00:00:00 2001 From: Robert Zakrzewski Date: Fri, 21 Jun 2024 14:53:24 +0200 Subject: [PATCH 07/12] Update libgccjit version with fixed is_same_type_as for vector types --- libgccjit.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgccjit.version b/libgccjit.version index 71a61a4b873..8cce7358321 100644 --- a/libgccjit.version +++ b/libgccjit.version @@ -1 +1 @@ -272d0ccced960394fe6ff2b40b01610208cb4940 +d61ce945badf4c9d8237a13ca135e3c46ad13be3 From 2eaac2388d6172922d0b8ac62979ff4fa6a2355c Mon Sep 17 00:00:00 2001 From: Robert Zakrzewski Date: Fri, 21 Jun 2024 16:42:21 +0200 Subject: [PATCH 08/12] Refactor type_f16|32|128 functions. Common type_kind() fix --- src/type_.rs | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/type_.rs b/src/type_.rs index 7bcc71e581d..eaa16c44897 100644 --- a/src/type_.rs +++ b/src/type_.rs @@ -125,47 +125,32 @@ fn type_isize(&self) -> Type<'gcc> { self.isize_type } - #[cfg(feature = "master")] fn type_f16(&self) -> Type<'gcc> { + #[cfg(feature = "master")] if self.supports_f16_type { return self.context.new_c_type(CType::Float16); } - unimplemented!("f16") + bug!("unsupported float width 16") } - #[cfg(not(feature = "master"))] - fn type_f16(&self) -> Type<'gcc> { - unimplemented!("f16") - } - - #[cfg(feature = "master")] fn type_f32(&self) -> Type<'gcc> { + #[cfg(feature = "master")] if self.supports_f32_type { return self.context.new_c_type(CType::Float32); } self.float_type } - #[cfg(not(feature = "master"))] - fn type_f32(&self) -> Type<'gcc> { - self.float_type - } - fn type_f64(&self) -> Type<'gcc> { self.double_type } - #[cfg(feature = "master")] fn type_f128(&self) -> Type<'gcc> { + #[cfg(feature = "master")] if self.supports_f128_type { return self.context.new_c_type(CType::Float128); } - unimplemented!("f128") - } - - #[cfg(not(feature = "master"))] - fn type_f128(&self) -> Type<'gcc> { - unimplemented!("f128") + bug!("unsupported float width 128") } fn type_func(&self, params: &[Type<'gcc>], return_type: Type<'gcc>) -> Type<'gcc> { From dabf5faff0bb0154d702561266826cc0cd53eec4 Mon Sep 17 00:00:00 2001 From: Robert Zakrzewski Date: Fri, 21 Jun 2024 22:10:52 +0200 Subject: [PATCH 09/12] Add support for Float64 --- src/base.rs | 2 ++ src/context.rs | 3 +++ src/type_.rs | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/src/base.rs b/src/base.rs index ea2b0b791b7..e88fde8ebef 100644 --- a/src/base.rs +++ b/src/base.rs @@ -186,6 +186,7 @@ fn module_codegen( // context. let f16_type_supported = target_info.supports_target_dependent_type(CType::Float16); let f32_type_supported = target_info.supports_target_dependent_type(CType::Float32); + let f64_type_supported = target_info.supports_target_dependent_type(CType::Float64); let f128_type_supported = target_info.supports_target_dependent_type(CType::Float128); // TODO: improve this to avoid passing that many arguments. let cx = CodegenCx::new( @@ -195,6 +196,7 @@ fn module_codegen( target_info.supports_128bit_int(), f16_type_supported, f32_type_supported, + f64_type_supported, f128_type_supported, ); diff --git a/src/context.rs b/src/context.rs index 53a2b09217a..6beed91270b 100644 --- a/src/context.rs +++ b/src/context.rs @@ -70,6 +70,7 @@ pub struct CodegenCx<'gcc, 'tcx> { pub supports_128bit_integers: bool, pub supports_f16_type: bool, pub supports_f32_type: bool, + pub supports_f64_type: bool, pub supports_f128_type: bool, pub float_type: Type<'gcc>, @@ -135,6 +136,7 @@ pub fn new( supports_128bit_integers: bool, supports_f16_type: bool, supports_f32_type: bool, + supports_f64_type: bool, supports_f128_type: bool, ) -> Self { let check_overflow = tcx.sess.overflow_checks(); @@ -313,6 +315,7 @@ pub fn new( supports_128bit_integers, supports_f16_type, supports_f32_type, + supports_f64_type, supports_f128_type, float_type, diff --git a/src/type_.rs b/src/type_.rs index eaa16c44897..093ddbf8137 100644 --- a/src/type_.rs +++ b/src/type_.rs @@ -142,6 +142,10 @@ fn type_f32(&self) -> Type<'gcc> { } fn type_f64(&self) -> Type<'gcc> { + #[cfg(feature = "master")] + if self.supports_f64_type { + return self.context.new_c_type(CType::Float64); + } self.double_type } From 16e1ad7327b070a11d4bbf01a343c24e2dd34553 Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Tue, 25 Jun 2024 08:10:29 -0400 Subject: [PATCH 10/12] Fix clippy warnings --- src/context.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/context.rs b/src/context.rs index 6beed91270b..5ece10cc70d 100644 --- a/src/context.rs +++ b/src/context.rs @@ -129,6 +129,7 @@ pub struct CodegenCx<'gcc, 'tcx> { } impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { + #[allow(clippy::too_many_arguments)] pub fn new( context: &'gcc Context<'gcc>, codegen_unit: &'tcx CodegenUnit<'tcx>, From 73db24970f86e6495db1548b235334ed98ba8a6a Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Tue, 25 Jun 2024 08:43:48 -0400 Subject: [PATCH 11/12] Add comment about compiler_builtins --- build_system/build_sysroot/Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/build_system/build_sysroot/Cargo.toml b/build_system/build_sysroot/Cargo.toml index d0d21a044fd..e4669923623 100644 --- a/build_system/build_sysroot/Cargo.toml +++ b/build_system/build_sysroot/Cargo.toml @@ -6,6 +6,7 @@ resolver = "2" [dependencies] core = { path = "./sysroot_src/library/core" } +# TODO: after the sync, revert to using version 0.1. # compiler_builtins = "0.1" compiler_builtins = "=0.1.109" alloc = { path = "./sysroot_src/library/alloc" } From 9274c63df3f584a58d4f916a4de2871c2e92621d Mon Sep 17 00:00:00 2001 From: Antoni Boucher Date: Tue, 25 Jun 2024 09:00:36 -0400 Subject: [PATCH 12/12] Change Void to unreachable --- src/type_.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/type_.rs b/src/type_.rs index 093ddbf8137..184367e9cde 100644 --- a/src/type_.rs +++ b/src/type_.rs @@ -206,7 +206,7 @@ fn type_kind(&self, typ: Type<'gcc>) -> TypeKind { 4 => TypeKind::Float, 8 => TypeKind::Double, 16 => TypeKind::FP128, - _ => TypeKind::Void, + size => unreachable!("Floating-point type of size {}", size), } } else if typ == self.type_void() { TypeKind::Void