mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 10:39:45 +00:00
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 |
||
|---|---|---|
| .. | ||
| base-db | ||
| cfg | ||
| edition | ||
| hir | ||
| hir-def | ||
| hir-expand | ||
| hir-ty | ||
| ide | ||
| ide-assists | ||
| ide-completion | ||
| ide-db | ||
| ide-diagnostics | ||
| ide-ssr | ||
| intern | ||
| load-cargo | ||
| mbe | ||
| parser | ||
| paths | ||
| proc-macro-api | ||
| proc-macro-srv | ||
| proc-macro-srv-cli | ||
| profile | ||
| project-model | ||
| query-group-macro | ||
| rust-analyzer | ||
| span | ||
| stdx | ||
| syntax | ||
| syntax-bridge | ||
| test-fixture | ||
| test-utils | ||
| toolchain | ||
| tt | ||
| vfs | ||
| vfs-notify | ||