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, which will be done in a followup.
This commit is contained in:
Erik Desjardins
2023-01-22 23:03:58 -05:00
parent 96f8f99589
commit 009192b01b
26 changed files with 224 additions and 179 deletions

View File

@@ -244,7 +244,7 @@ fn adjust_for_rust_scalar<'tcx>(
}
// Only pointer types handled below.
let Scalar::Initialized { value: Pointer, valid_range} = scalar else { return };
let Scalar::Initialized { value: Pointer(_), valid_range} = scalar else { return };
if !valid_range.contains(0) {
attrs.set(ArgAttribute::NonNull);
@@ -479,7 +479,7 @@ fn fn_abi_adjust_for_abi<'tcx>(
}
let size = arg.layout.size;
if arg.layout.is_unsized() || size > Pointer.size(cx) {
if arg.layout.is_unsized() || size > Pointer(AddressSpace::DATA).size(cx) {
arg.make_indirect();
} else {
// We want to pass small aggregates as immediates, but using