[PATCH] D145849: [Driver][xray] Allow XRay on Apple Silicon

Oleksii Lozovskyi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 11 07:57:38 PST 2023


ilammy created this revision.
ilammy added reviewers: MaskRay, ianlevesque, dberris.
ilammy added a project: clang.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
ilammy requested review of this revision.
Herald added a subscriber: cfe-commits.

Codegen can handle XRay for AArch64, tell the driver to allow it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145849

Files:
  clang/lib/Driver/XRayArgs.cpp
  clang/test/Driver/XRay/xray-instrument-macos.c
  clang/test/Driver/XRay/xray-instrument-os.c


Index: clang/test/Driver/XRay/xray-instrument-os.c
===================================================================
--- clang/test/Driver/XRay/xray-instrument-os.c
+++ clang/test/Driver/XRay/xray-instrument-os.c
@@ -1,4 +1,4 @@
 // RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
-// XFAIL: target={{.*-(linux|freebsd).*}}, target=x86_64-apple-{{(darwin|macos).*}}
+// XFAIL: target={{.*-(linux|freebsd).*}}, target={{(aarch64|x86_64)-apple-(darwin|macos).*}}
 // REQUIRES: target={{(amd64|x86_64|x86_64h|arm|aarch64|arm64)-.*}}
 typedef int a;
Index: clang/test/Driver/XRay/xray-instrument-macos.c
===================================================================
--- clang/test/Driver/XRay/xray-instrument-macos.c
+++ clang/test/Driver/XRay/xray-instrument-macos.c
@@ -1,4 +1,5 @@
+// RUN: %clang -o /dev/null -v -fxray-instrument -target aarch64-apple-darwin20 -c %s
 // RUN: %clang -o /dev/null -v -fxray-instrument -target x86_64-apple-macos10.11 -c %s
 // RUN: %clang -o /dev/null -v -fxray-instrument -target x86_64-apple-darwin15 -c %s
-// REQUIRES: x86_64 || x86_64h
+// REQUIRES: aarch64 || x86_64 || x86_64h
 typedef int a;
Index: clang/lib/Driver/XRayArgs.cpp
===================================================================
--- clang/lib/Driver/XRayArgs.cpp
+++ clang/lib/Driver/XRayArgs.cpp
@@ -52,11 +52,20 @@
           << (std::string(XRayInstrumentOption) + " on " + Triple.str());
     }
   } else if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() ||
-             Triple.isOSNetBSD() || Triple.isMacOSX()) {
+             Triple.isOSNetBSD()) {
     if (Triple.getArch() != llvm::Triple::x86_64) {
       D.Diag(diag::err_drv_clang_unsupported)
           << (std::string(XRayInstrumentOption) + " on " + Triple.str());
     }
+  } else if (Triple.isMacOSX()) {
+    switch (Triple.getArch()) {
+    case llvm::Triple::x86_64:
+    case llvm::Triple::aarch64:
+      break;
+    default:
+      D.Diag(diag::err_drv_clang_unsupported)
+          << (std::string(XRayInstrumentOption) + " on " + Triple.str());
+    }
   } else if (Triple.getOS() == llvm::Triple::Fuchsia) {
     switch (Triple.getArch()) {
     case llvm::Triple::x86_64:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145849.504369.patch
Type: text/x-patch
Size: 2174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230311/7c3076e5/attachment-0001.bin>


More information about the cfe-commits mailing list