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

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 22:49:32 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);
----------------
s-barannikov wrote:

Could you add a brief comment on how this works? The fact that it can clone the default spec into a different address space isn't obvious.


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


More information about the llvm-commits mailing list