Repository navigation
add core::arch::{x86, x86_64}::x87_f80
#163992
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
base: main
Are you sure you want to change the base?
Changes from all commits
c3f5e5d
0c1c3d6
f5ac1b0
352accd
18ceb9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| use std::fmt::Write; | ||
|
|
||
| use rustc_abi::Primitive::{Float, Int, Pointer}; | ||
| use rustc_abi::Primitive::{self, Float, Int, Pointer}; | ||
| use rustc_abi::{Align, BackendRepr, FieldsShape, Scalar, Size, Variants}; | ||
| use rustc_codegen_ssa::traits::*; | ||
| use rustc_middle::ty::layout::{LayoutOf, TyAndLayout}; | ||
|
|
@@ -85,7 +85,16 @@ fn uncached_llvm_type<'a, 'tcx>( | |
| } | ||
| } | ||
| } | ||
| FieldsShape::Array { count, .. } => cx.type_array(layout.field(cx, 0).llvm_type(cx), count), | ||
| FieldsShape::Array { count, .. } => { | ||
| let element_ty = layout.field(cx, 0); | ||
| if let BackendRepr::Scalar(scalar) = element_ty.backend_repr | ||
| && scalar.primitive() == Primitive::Float(rustc_abi::Float::X87F80) | ||
| { | ||
| cx.type_padding_filler(element_ty.size * count, element_ty.align) | ||
| } else { | ||
| cx.type_array(element_ty.llvm_type(cx), count) | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a bit ugly. We could have |
||
| } | ||
| FieldsShape::Arbitrary { .. } => match name { | ||
| None => { | ||
| let (llfields, packed) = struct_llfields(cx, layout); | ||
|
|
@@ -135,7 +144,15 @@ fn struct_llfields<'a, 'tcx>( | |
| result.push(cx.type_padding_filler(padding, padding_align)); | ||
| debug!(" padding before: {:?}", padding); | ||
| } | ||
| result.push(field.llvm_type(cx)); | ||
|
|
||
| if let BackendRepr::Scalar(scalar) = field.backend_repr | ||
| && scalar.primitive() == Primitive::Float(rustc_abi::Float::X87F80) | ||
| { | ||
| result.push(cx.type_padding_filler(field.size, field.align)); | ||
| } else { | ||
| result.push(field.llvm_type(cx)); | ||
| } | ||
|
|
||
| offset = target_offset + field.size; | ||
| prev_effective_align = effective_field_align; | ||
| } | ||
|
|
@@ -192,12 +209,14 @@ pub(crate) trait LayoutLlvmExt<'tcx> { | |
|
|
||
| impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> { | ||
| /// Gets the LLVM type corresponding to a Rust type, i.e., `rustc_middle::ty::Ty`. | ||
| /// The pointee type of the pointer in `PlaceRef` is always this type. | ||
| /// For sized types, it is also the right LLVM type for an `alloca` | ||
| /// containing a value of that type, and most immediates (except `bool`). | ||
| /// | ||
| /// For sized types, this is the in-memory type that is used for stores and loads. | ||
| /// The type used for immediates may be different, see [`Self::immediate_llvm_type`]. | ||
|
Comment on lines
+213
to
+214
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can workshop this some more. I did just remove the line about the pointer type, it's blatantly wrong and didn't really fit in the reformatted text. |
||
| /// | ||
| /// Unsized types, however, are represented by a "minimal unit", e.g. | ||
| /// `[T]` becomes `T`, while `str` and `Trait` turn into `i8` - this | ||
| /// is useful for indexing slices, as `&[T]`'s data pointer is `T*`. | ||
| /// | ||
| /// If the type is an unsized struct, the regular layout is generated, | ||
| /// with the innermost trailing unsized field using the "minimal unit" | ||
| /// of that field's type - this is useful for taking the address of | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.