rust/compiler/rustc_abi/src
bors 2f8eeb2bba Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubilee
Allow custom default address spaces and parse `p-` specifications in the datalayout string

Some targets, such as CHERI, use as default an address space different from the "normal" default address space `0` (in the case of CHERI, [200 is used](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-877.pdf)). Currently, `rustc` does not allow to specify custom address spaces and does not take into consideration [`p-` specifications in the datalayout string](https://llvm.org/docs/LangRef.html#langref-datalayout).

This patch tries to mitigate these problems by allowing targets to define a custom default address space (while keeping the default value to address space `0`) and adding the code to parse the `p-` specifications in `rustc_abi`. The main changes are that `TargetDataLayout` now uses functions to refer to pointer-related informations, instead of having specific fields for the size and alignment of pointers in the default address space; furthermore, the two `pointer_size` and `pointer_align` fields in `TargetDataLayout` are replaced with an `FxHashMap` that holds info for all the possible address spaces, as parsed by the `p-` specifications.

The potential performance drawbacks of not having ad-hoc fields for the default address space will be tested in this PR's CI run.

r? workingjubilee
2025-07-07 17:28:14 +00:00
..
callconv compiler: split vector_align into cabi and llvmlike 2025-02-20 19:55:29 -08:00
extern_abi compiler: remove rustc_abi::lookup and AbiUnsupported 2025-02-11 20:18:01 -08:00
layout Remove PointerLike trait 2025-07-03 20:03:49 +00:00
callconv.rs rename BackendRepr::Vector → SimdVector 2025-02-28 17:17:45 +01:00
canon_abi.rs compiler: Trim the misleading C from ExternAbi::CCmse* 2025-06-25 00:52:09 -07:00
extern_abi.rs compiler: Trim the misleading C from ExternAbi::CCmse* 2025-06-25 00:52:09 -07:00
layout.rs compiler: Rename LayoutS to LayoutData in comments 2025-06-20 12:50:12 -05:00
lib.rs Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubilee 2025-07-07 17:28:14 +00:00
tests.rs coverage: Set up MC/DC bitmaps without additional unsafe code 2024-05-01 09:55:22 +10:00