rust/compiler/rustc_middle/src/ty
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
..
consts compiler: Parse p- specs in datalayout string, allow definition of custom default data address space 2025-07-07 09:04:53 +02:00
context Use rustc_thread_pool instead of rustc-rayon-core 2025-06-11 12:26:42 -07:00
inhabitedness Don't build ParamEnv and do trait solving in ItemCtxts 2025-06-17 14:18:34 +01:00
print Auto merge of #143182 - xdoardo:more-addrspace, r=workingjubilee 2025-07-07 17:28:14 +00:00
abstract_const.rs Clean up trivial traversal/lift impl generator macro calls. 2025-02-06 13:31:43 +11:00
adjustment.rs Remove support for dyn* 2025-07-01 19:00:21 +00:00
adt.rs Port #[non_exhaustive] to the new attribute parsing infrastructure 2025-07-04 20:30:42 +02:00
assoc.rs Update docs for AssocItems::filter_by_name_unhygienic 2025-04-19 21:06:52 +02:00
cast.rs Simplify intra-crate qualifiers. 2025-02-11 14:59:13 +11:00
closure.rs Use gen blocks in the compiler instead of from_coroutine 2025-06-20 18:57:52 +00:00
codec.rs Update cfg(bootstrap) 2025-07-01 10:55:49 -07:00
consts.rs Introduce trivial WF functions, use it in fast path 2025-06-24 01:42:28 +00:00
context.rs Auto merge of #139598 - compiler-errors:no-bound-var-symbol, r=WaffleLapkin 2025-07-05 06:29:56 +00:00
diagnostics.rs Auto merge of #131160 - ismailarilik:handle-potential-query-instability-lint-for-rustc-middle, r=oli-obk 2025-05-06 01:36:23 +00:00
elaborate_impl.rs Uplift elaboration 2024-07-07 11:28:01 -04:00
erase_regions.rs add additional TypeFlags fast paths 2025-05-26 19:57:48 +00:00
error.rs Remove weak alias terminology 2025-04-24 11:59:20 +01:00
fast_reject.rs Use DeepRejectCtxt to quickly reject ParamEnv candidates 2024-09-02 19:59:18 +03:00
fold.rs add additional TypeFlags fast paths 2025-05-26 19:57:48 +00:00
generic_args.rs Use more slicing and slice interning over iterable interning 2025-06-13 01:16:01 +02:00
generics.rs Change const trait bound syntax from ~const to [const] 2025-06-26 13:46:45 +00:00
impls_ty.rs Rename unpack to kind 2025-05-27 11:14:45 +00:00
instance.rs setup CI and tidy to use typos for spellchecking and fix few typos 2025-07-03 10:51:06 +03:00
intrinsic.rs add new rustc_const_stable_intrinsic attribute for const-stable intrinsics 2024-11-04 23:27:46 +01:00
layout.rs compiler: Parse p- specs in datalayout string, allow definition of custom default data address space 2025-07-07 09:04:53 +02:00
list.rs Move FlagComputation, PatternKind, and TypeWalker to rustc_type_ir 2025-04-12 22:46:11 +00:00
mod.rs Rewrite empty attribute lint 2025-07-06 09:51:35 +02:00
normalize_erasing_regions.rs Squash fold into ty 2025-03-15 06:34:36 +00:00
opaque_types.rs Fix some var names 2025-05-27 11:14:47 +00:00
parameterized.rs Introduce tcx.anon_const_kind query 2025-05-21 20:20:19 +01:00
pattern.rs Add or-patterns to pattern types 2025-04-28 07:50:18 +00:00
predicate.rs add additional TypeFlags fast paths 2025-05-26 19:57:48 +00:00
region.rs Nits 2025-07-04 18:26:09 +00:00
relate.rs Rename unpack to kind 2025-05-27 11:14:45 +00:00
rvalue_scopes.rs Remove ScopeDepth entirely. 2025-03-28 08:31:47 +01:00
significant_drop_order.rs setup CI and tidy to use typos for spellchecking and fix few typos 2025-07-03 10:51:06 +03:00
structural_impls.rs Fix pretty printing of placeholder types 2025-07-04 18:26:09 +00:00
sty.rs Same for types 2025-07-04 18:26:09 +00:00
trait_def.rs Remove a function that has no necessary callers 2025-04-02 07:30:11 +00:00
typeck_results.rs fix typo 2025-06-06 13:15:46 +02:00
util.rs Report infer ty errors during hir ty lowering 2025-06-27 07:51:38 +00:00
visit.rs TypeVisiting binders no longer requires TypeFolding its interior 2025-06-13 17:54:45 +00:00
vtable.rs compiler: Parse p- specs in datalayout string, allow definition of custom default data address space 2025-07-07 09:04:53 +02:00