Rollup merge of #107248 - erikdesjardins:addrspace, r=oli-obk
abi: add AddressSpace field to Primitive::Pointer ...and remove it from `PointeeInfo`, which isn't meant for this. There are still various places (marked with FIXMEs) that assume all pointers have the same size and alignment. Fixing this requires parsing non-default address spaces in the data layout string (and various other changes), which will be done in a followup. (That is, if it's actually worth it to support multiple different pointer sizes. There is a lot of code that would be affected by that.) Fixes #106367 r? ``@oli-obk`` cc ``@Patryk27``
This commit is contained in:
commit
a8b5e5d9db
28 changed files with 235 additions and 203 deletions
|
@ -39,7 +39,7 @@ where
|
|||
{
|
||||
match arg_layout.abi {
|
||||
Abi::Scalar(scalar) => match scalar.primitive() {
|
||||
abi::Int(..) | abi::Pointer => {
|
||||
abi::Int(..) | abi::Pointer(_) => {
|
||||
if arg_layout.size.bits() > xlen {
|
||||
return Err(CannotUseFpConv);
|
||||
}
|
||||
|
|
|
@ -346,7 +346,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
|
|||
// The primitive for this algorithm.
|
||||
Abi::Scalar(scalar) => {
|
||||
let kind = match scalar.primitive() {
|
||||
abi::Int(..) | abi::Pointer => RegKind::Integer,
|
||||
abi::Int(..) | abi::Pointer(_) => RegKind::Integer,
|
||||
abi::F32 | abi::F64 => RegKind::Float,
|
||||
};
|
||||
Ok(HomogeneousAggregate::Homogeneous(Reg { kind, size: self.size }))
|
||||
|
|
|
@ -45,7 +45,7 @@ where
|
|||
{
|
||||
match arg_layout.abi {
|
||||
Abi::Scalar(scalar) => match scalar.primitive() {
|
||||
abi::Int(..) | abi::Pointer => {
|
||||
abi::Int(..) | abi::Pointer(_) => {
|
||||
if arg_layout.size.bits() > xlen {
|
||||
return Err(CannotUseFpConv);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ where
|
|||
{
|
||||
let dl = cx.data_layout();
|
||||
|
||||
if !scalar.primitive().is_float() {
|
||||
if !matches!(scalar.primitive(), abi::F32 | abi::F64) {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -83,11 +83,11 @@ where
|
|||
(abi::F32, _) => offset += Reg::f32().size,
|
||||
(_, abi::F64) => offset += Reg::f64().size,
|
||||
(abi::Int(i, _signed), _) => offset += i.size(),
|
||||
(abi::Pointer, _) => offset += Reg::i64().size,
|
||||
(abi::Pointer(_), _) => offset += Reg::i64().size,
|
||||
_ => {}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
data = arg_scalar(cx, scalar2, offset, data);
|
||||
|
|
|
@ -50,7 +50,7 @@ where
|
|||
Abi::Uninhabited => return Ok(()),
|
||||
|
||||
Abi::Scalar(scalar) => match scalar.primitive() {
|
||||
abi::Int(..) | abi::Pointer => Class::Int,
|
||||
abi::Int(..) | abi::Pointer(_) => Class::Int,
|
||||
abi::F32 | abi::F64 => Class::Sse,
|
||||
},
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
|
|||
C: HasDataLayout,
|
||||
{
|
||||
match self.abi {
|
||||
Abi::Scalar(scalar) => scalar.primitive().is_float(),
|
||||
Abi::Scalar(scalar) => matches!(scalar.primitive(), F32 | F64),
|
||||
Abi::Aggregate { .. } => {
|
||||
if self.fields.count() == 1 && self.fields.offset(0).bytes() == 0 {
|
||||
self.field(cx, 0).is_single_fp_element(cx)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue