about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/debuginfo
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-03-01 03:36:11 +0000
committerbors <bors@rust-lang.org>2024-03-01 03:36:11 +0000
commit6cbf0926d54c80ea6d15df333be9281f65bbeb36 (patch)
treea68611bb2c60aed0f51ecea1c44568b40bfa61a5 /compiler/rustc_codegen_llvm/src/debuginfo
parent6f435eb0eb2926cdb6640b3382b9e3e21ef05f07 (diff)
parent406790e9d1f2a02f3b4d004cca7d33e69ef7dca5 (diff)
downloadrust-6cbf0926d54c80ea6d15df333be9281f65bbeb36.tar.gz
rust-6cbf0926d54c80ea6d15df333be9281f65bbeb36.zip
Auto merge of #121728 - tgross35:f16-f128-step1-ty-updates, r=compiler-errors
Add stubs in IR and ABI for `f16` and `f128`

This is the very first step toward the changes in https://github.com/rust-lang/rust/pull/114607 and the [`f16` and `f128` RFC](https://rust-lang.github.io/rfcs/3453-f16-and-f128.html). It adds the types to `rustc_type_ir::FloatTy` and `rustc_abi::Primitive`, and just propagates those out as `unimplemented!` stubs where necessary.

These types do not parse yet so there is no feature gate, and it should be okay to use `unimplemented!`.

The next steps will probably be AST support with parsing and the feature gate.

r? `@compiler-errors`
cc `@Nilstrieb` suggested breaking the PR up in https://github.com/rust-lang/rust/pull/120645#issuecomment-1925900572
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo')
-rw-r--r--compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs4
-rw-r--r--compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs2
2 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
index f961cd2d00b..045b6d2b651 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
@@ -695,9 +695,13 @@ impl MsvcBasicName for ty::UintTy {
 
 impl MsvcBasicName for ty::FloatTy {
     fn msvc_basic_name(self) -> &'static str {
+        // FIXME: f16 and f128 have no MSVE representation. We could improve the debuginfo.
+        // See: <https://github.com/rust-lang/rust/pull/114607/files#r1454683264>
         match self {
+            ty::FloatTy::F16 => "half",
             ty::FloatTy::F32 => "float",
             ty::FloatTy::F64 => "double",
+            ty::FloatTy::F128 => "fp128",
         }
     }
 }
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs
index 7f671d1d061..657e9ce998f 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs
@@ -122,8 +122,10 @@ fn tag_base_type<'ll, 'tcx>(
             // Niche tags are always normalized to unsized integers of the correct size.
             match tag.primitive() {
                 Primitive::Int(t, _) => t,
+                Primitive::F16 => Integer::I16,
                 Primitive::F32 => Integer::I32,
                 Primitive::F64 => Integer::I64,
+                Primitive::F128 => Integer::I128,
                 // FIXME(erikdesjardins): handle non-default addrspace ptr sizes
                 Primitive::Pointer(_) => {
                     // If the niche is the NULL value of a reference, then `discr_enum_ty` will be