[llvm] [DataLayout] Refactor storage of non-integral address spaces (PR #105734)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 23 09:50:17 PDT 2024


================
@@ -614,12 +616,21 @@ Error DataLayout::parseLayoutString(StringRef LayoutString) {
 
   // Split the data layout string into specifications separated by '-' and
   // parse each specification individually, updating internal data structures.
+  SmallVector<unsigned, 8> NonIntegralAddressSpaces;
   for (StringRef Spec : split(LayoutString, '-')) {
     if (Spec.empty())
       return createStringError("empty specification is not allowed");
-    if (Error Err = parseSpecification(Spec))
+    if (Error Err = parseSpecification(Spec, NonIntegralAddressSpaces))
       return Err;
   }
+  // Mark all address spaces that were qualified as non-integral now. This has
+  // to be done later since the non-integral property is not part of the data
+  // layout pointer specification.
+  for (unsigned AS : NonIntegralAddressSpaces) {
+    const PointerSpec &PS = getPointerSpec(AS);
+    setPointerSpec(AS, PS.BitWidth, PS.ABIAlign, PS.PrefAlign, PS.IndexBitWidth,
+                   true);
----------------
arichardson wrote:

getPointerSpec(AS) returns the spec for AS0 if nothing else exists - will add a comment.

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


More information about the llvm-commits mailing list