[clang] [Clang][CodeGen] Start migrating away from assuming the Default AS is 0 (PR #88182)
Jessica Clarke via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 9 13:12:53 PDT 2024
jrtc27 wrote:
> Why can't we just declare that the "generic" address-space must always be 0? The specific numbers we use for address-spaces are completely arbitrary anyway.
https://github.com/CTSRD-CHERI/llvm-project/issues/621 is what I wrote up for CHERI LLVM, but is a bit terse if you don't know about CHERI details. In essence, for us downstream in CHERI LLVM, we have two ABIs: hybrid and purecap. Hybrid is your standard pointers-are-integers ABI, with the ability to annotate select pointers as instead being capabilities. AS0 is used for integer pointers, as the default thing and to follow upstream, and AS200 is used for capability pointers as the new special thing. When it comes to purecap, *all* pointers are to be capabilities. We could change AS0 to be a capability in that scenario, but now the backend becomes a lot more complicated, because what address space means what is changing based on the ABI. So instead we leave AS0 as meaning integer pointers (currently no syntax for them in CHERI C as they're not that useful, but they work fine in IR) and AS200 as meaning capability pointers, but that means AS0 can't be used for `void *` any more, which gets annoying with things like libcall handling code, where we have various hacks.
https://github.com/llvm/llvm-project/pull/88182
More information about the cfe-commits
mailing list