[llvm] [WIP] Extend data layout to add non zero null value for address space. (PR #83109)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 06:01:33 PST 2024


================
@@ -502,6 +513,31 @@ Error DataLayout::parseSpecifier(StringRef Desc) {
         return Err;
       break;
     }
+    case 'z': {
+      unsigned AddrSpace = 0;
+      if (!Tok.empty())
+        if (Error Err = getInt(Tok, AddrSpace))
+          return Err;
+      if (!isUInt<24>(AddrSpace))
+        return reportError("Invalid address space, must be a 24-bit integer");
+
+      if (Rest.empty())
+        return reportError("Missing address space specification for pointer in "
+                           "datalayout string");
+      if (Error Err = ::split(Rest, ':', Split))
+        return Err;
+      int64_t Value;
+      if (Error Err = getIntForAddrSpace(Tok, Value))
+        return Err;
+
+      // for default address space e.g., z:0
+      if (AddrSpace == 0) {
----------------
arsenm wrote:

The default address space shouldn't get special handling, there should be special handling for the default. That is, the datalayout should have a way of specifying the behavior for 0, and separately expressing the behavior for unlisted address spaces 

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


More information about the llvm-commits mailing list