r287518 - [XRay] Support AArch64 in Clang

Dean Michael Berris via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 20 19:25:00 PST 2016


Author: dberris
Date: Sun Nov 20 21:24:59 2016
New Revision: 287518

URL: http://llvm.org/viewvc/llvm-project?rev=287518&view=rev
Log:
[XRay] Support AArch64 in Clang

This patch adds XRay support in Clang for AArch64 target.
This patch is one of a series:

LLVM: https://reviews.llvm.org/D26412
compiler-rt: https://reviews.llvm.org/D26413

Author: rSerge

Reviewers: rengolin, dberris

Subscribers: aemerson, cfe-commits, iid_iunknown

Differential Revision: https://reviews.llvm.org/D26415

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c
    cfe/trunk/test/Driver/XRay/xray-instrument-os.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=287518&r1=287517&r2=287518&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sun Nov 20 21:24:59 2016
@@ -4900,14 +4900,20 @@ void Clang::ConstructJob(Compilation &C,
   if (Args.hasFlag(options::OPT_fxray_instrument,
                    options::OPT_fnoxray_instrument, false)) {
     const char *const XRayInstrumentOption = "-fxray-instrument";
-    if (Triple.getOS() == llvm::Triple::Linux &&
-        (Triple.getArch() == llvm::Triple::arm ||
-         Triple.getArch() == llvm::Triple::x86_64)) {
-      // Supported.
-    } else {
+    if (Triple.getOS() == llvm::Triple::Linux)
+      switch (Triple.getArch()) {
+      case llvm::Triple::x86_64:
+      case llvm::Triple::arm:
+      case llvm::Triple::aarch64:
+        // Supported.
+        break;
+      default:
+        D.Diag(diag::err_drv_clang_unsupported)
+            << (std::string(XRayInstrumentOption) + " on " + Triple.str());
+      }
+    else
       D.Diag(diag::err_drv_clang_unsupported)
-          << (std::string(XRayInstrumentOption) + " on " + Triple.str());
-    }
+          << (std::string(XRayInstrumentOption) + " on non-Linux target OS");
     CmdArgs.push_back(XRayInstrumentOption);
     if (const Arg *A =
             Args.getLastArg(options::OPT_fxray_instruction_threshold_,

Modified: cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c?rev=287518&r1=287517&r2=287518&view=diff
==============================================================================
--- cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c (original)
+++ cfe/trunk/test/Driver/XRay/xray-instrument-cpu.c Sun Nov 20 21:24:59 2016
@@ -1,4 +1,4 @@
 // RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
-// XFAIL: amd64-, x86_64-, x86_64h-, arm
+// XFAIL: amd64-, x86_64-, x86_64h-, arm, aarch64, arm64
 // REQUIRES: linux
 typedef int a;

Modified: cfe/trunk/test/Driver/XRay/xray-instrument-os.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/XRay/xray-instrument-os.c?rev=287518&r1=287517&r2=287518&view=diff
==============================================================================
--- cfe/trunk/test/Driver/XRay/xray-instrument-os.c (original)
+++ cfe/trunk/test/Driver/XRay/xray-instrument-os.c Sun Nov 20 21:24:59 2016
@@ -1,4 +1,4 @@
 // RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
 // XFAIL: -linux-
-// REQUIRES-ANY: amd64, x86_64, x86_64h, arm
+// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
 typedef int a;




More information about the cfe-commits mailing list