rustc_abi: remove Primitive::{is_float,is_int}
there were fixmes for this already i am about to remove is_ptr (since callers need to properly distinguish between pointers in different address spaces), so might as well do this at the same time
This commit is contained in:
parent
a5fa99eed2
commit
96f8f99589
@ -887,18 +887,6 @@ impl Primitive {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME(eddyb) remove, it's trivial thanks to `matches!`.
|
|
||||||
#[inline]
|
|
||||||
pub fn is_float(self) -> bool {
|
|
||||||
matches!(self, F32 | F64)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME(eddyb) remove, it's completely unused.
|
|
||||||
#[inline]
|
|
||||||
pub fn is_int(self) -> bool {
|
|
||||||
matches!(self, Int(..))
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn is_ptr(self) -> bool {
|
pub fn is_ptr(self) -> bool {
|
||||||
matches!(self, Pointer)
|
matches!(self, Pointer)
|
||||||
|
@ -20,7 +20,7 @@ where
|
|||||||
{
|
{
|
||||||
let dl = cx.data_layout();
|
let dl = cx.data_layout();
|
||||||
|
|
||||||
if !scalar.primitive().is_float() {
|
if !matches!(scalar.primitive(), abi::F32 | abi::F64) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ where
|
|||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset.bytes() % 4) != 0 && scalar2.primitive().is_float() {
|
if (offset.bytes() % 4) != 0 && matches!(scalar2.primitive(), abi::F32 | abi::F64) {
|
||||||
offset += Size::from_bytes(4 - (offset.bytes() % 4));
|
offset += Size::from_bytes(4 - (offset.bytes() % 4));
|
||||||
}
|
}
|
||||||
data = arg_scalar(cx, scalar2, offset, data);
|
data = arg_scalar(cx, scalar2, offset, data);
|
||||||
|
@ -129,7 +129,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
|
|||||||
C: HasDataLayout,
|
C: HasDataLayout,
|
||||||
{
|
{
|
||||||
match self.abi {
|
match self.abi {
|
||||||
Abi::Scalar(scalar) => scalar.primitive().is_float(),
|
Abi::Scalar(scalar) => matches!(scalar.primitive(), F32 | F64),
|
||||||
Abi::Aggregate { .. } => {
|
Abi::Aggregate { .. } => {
|
||||||
if self.fields.count() == 1 && self.fields.offset(0).bytes() == 0 {
|
if self.fields.count() == 1 && self.fields.offset(0).bytes() == 0 {
|
||||||
self.field(cx, 0).is_single_fp_element(cx)
|
self.field(cx, 0).is_single_fp_element(cx)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user