[clang] [lld] [llvm] [mlir] [IR] Introduce `T<address space>` to `DataLayout` to represent flat address space if a target supports it (PR #108786)
Alex Voicu via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 16 07:28:59 PDT 2024
================
@@ -3050,6 +3050,19 @@ as follows:
address space 0, this property only affects the default value to be used
when creating globals without additional contextual information (e.g. in
LLVM passes).
+``T<address space>``
+ Specifies the address space for a target's 'flat' address space. Note this
+ is not necessarily the same as addrspace 0, which LLVM sometimes refers to
+ as the generic address space. The flat address space is a generic address
+ space that can be used access multiple segments of memory with different
+ address spaces. Access of a memory location through a pointer with this
+ address space is expected to be legal but slower compared to the same memory
+ location accessed through a pointer with a different address space. This is
+ for targets with different pointer representations which can be converted
+ with the addrspacecast instruction. If a pointer is converted to this
+ address space, optimizations should attempt to replace the access with the
+ source address space. The absence of this specification indicates the target
+ does not have such a flat address space to optimize away.
----------------
AlexVlx wrote:
I don't think the latter has to be true, as there can be some degree of nesting for address spaces (for example, some targets have the constant AS simply be global + additional guarantees, but the two can physically / conceptually alias).
https://github.com/llvm/llvm-project/pull/108786
More information about the cfe-commits
mailing list