[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:27:25 PDT 2024


================
@@ -245,6 +246,7 @@ class DataLayout {
   unsigned getDefaultGlobalsAddressSpace() const {
     return DefaultGlobalsAddrSpace;
   }
+  unsigned getFlatAddressSpace() const { return FlatAddressSpace; }
----------------
AlexVlx wrote:

I think that for general ergonomics making this an `optional` is preferable to magic constant + comment. That'd unambiguously convey absence, and it's what optional is for. Whilst incredibly unlikely, it is currently not impossible for some future target do decide that AS UINT32_MAX carries semantic meaning, and run into trouble around this.

https://github.com/llvm/llvm-project/pull/108786


More information about the cfe-commits mailing list