[clang] [llvm] [clang][aarch64] Add support for the MSVC qualifiers __ptr32, __ptr64, __sptr, __uptr for AArch64 (PR #111879)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 14 14:16:12 PDT 2024


================
@@ -5570,15 +5583,7 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
   if (!T.isX86())
     return Res;
 
-  // If the datalayout matches the expected format, add pointer size address
-  // spaces to the datalayout.
-  std::string AddrSpaces = "-p270:32:32-p271:32:32-p272:64:64";
-  if (StringRef Ref = Res; !Ref.contains(AddrSpaces)) {
-    SmallVector<StringRef, 4> Groups;
-    Regex R("(e-m:[a-z](-p:32:32)?)(-[if]64:.*$)");
-    if (R.match(Res, &Groups))
-      Res = (Groups[1] + AddrSpaces + Groups[3]).str();
-  }
+  AddPtr32Ptr64AddrSpaces();
----------------
efriedma-quic wrote:

If there isn't any existing code using the new address-spaces, autoupgrading like this should work smoothly, I think?  Need to make sure the autoupgraded string matches the new string, but otherwise should be fine.  (I remember last time we made major changes for x86, the 128-bit integer alignment change, it was sort of tricky, but the issue mostly wasn't the layout string itself.)

--------

Having a dedicated address-space for __ptr64 is a little strange, but I guess if that's what we did on x86, there isn't really a reason to deviate.

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


More information about the cfe-commits mailing list