rust/compiler/rustc_session/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
..
config compiler: Parse p- specs in datalayout string, allow definition of custom default data address space 2025-07-07 09:04:53 +02:00
code_stats.rs Document why CodeStats::type_sizes is public 2025-04-21 17:36:36 +02:00
config.rs Rollup merge of #143387 - dpaoliello:shouldpanicfn, r=bjorn3 2025-07-04 16:22:36 +02:00
cstore.rs Initial support for dynamically linked crates 2025-05-04 22:03:15 +03:00
errors.rs move -Ctarget-feature handling into shared code 2025-06-19 09:44:01 +09:00
filesearch.rs rustc_session: Add a structure for keeping both explicit and default sysroots 2025-06-24 16:00:04 +03:00
lib.rs move -Ctarget-feature handling into shared code 2025-06-19 09:44:01 +09:00
options.rs Rollup merge of #142809 - KMJ-007:ad-type-analysis-flag, r=ZuseZ4 2025-06-25 22:14:55 +02:00
output.rs Initial support for dynamically linked crates 2025-05-04 22:03:15 +03:00
parse.rs Extract SilentEmitter 2025-06-19 13:05:01 -05:00
search_paths.rs Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
session.rs compiler: Deduplicate must_emit_unwind_tables() comments 2025-07-07 09:34:34 +02:00
utils.rs session: Cleanup CanonicalizedPath::new 2025-04-26 18:42:15 +03:00