[PATCH] D24799: [XRay] Check in Clang whether XRay supports the target when -fxray-instrument is passed

Serge Rogatch via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 4 10:56:08 PDT 2016


rSerge removed rL LLVM as the repository for this revision.
rSerge updated this revision to Diff 73509.
rSerge added a comment.

My mistake was that initially I only enumerated the unsupported targets from llvm\include\llvm\ADT\Triple.h . Now I've added also the cases from llvm\lib\Support\Triple.cpp .
`XFAIL` requires a list of all unsupported cases, which is currently much larger than the list of supported cases. However, AFAIK there is nothing like `XPASS` in LIT.


https://reviews.llvm.org/D24799

Files:
  lib/Driver/Tools.cpp
  test/Driver/xray-instrument.c


Index: test/Driver/xray-instrument.c
===================================================================
--- test/Driver/xray-instrument.c
+++ test/Driver/xray-instrument.c
@@ -0,0 +1,3 @@
+// RUN: %clang -v -fxray-instrument -c %s
+// XFAIL: armeb-, aarch64-, aarch64_be-, avr-, bpfel-, bpfeb-, hexagon-, mips-, mipsel-, mips64-, mips64el-, msp430-, ppc-, ppc64-, ppc64le-, r600-, amdgcn-, sparc-, sparcv9-, sparcel-, systemz-, tce-, thumb-, thumbeb-, x86-, xcore-, nvptx-, nvptx64-, le32-, le64-, amdil-, amdil64-, hsail-, hsail64-, spir-, spir64-, kalimba-, shave-, lanai-, wasm32-, wasm64-, renderscript32-, renderscript64-, i386-, i486-, i586-, i686-, i786-, i886-, i986-, powerpc-, ppc32-, powerpc64-, ppu-, powerpc64le-, ppc64le-, xscaleeb-, arm64-, mipseb-, mipsallegrex-, mipsallegrexel-, mips64eb-, s390x-, sparc64-
+typedef int a;
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4784,7 +4784,20 @@
 
   if (Args.hasFlag(options::OPT_fxray_instrument,
                    options::OPT_fnoxray_instrument, false)) {
-    CmdArgs.push_back("-fxray-instrument");
+    const char* const XRayInstrumentOption = "-fxray-instrument";
+    switch(getToolChain().getArch()) {
+    case llvm::Triple::arm:
+    case llvm::Triple::x86_64:
+      break;
+    default:
+    {
+      std::string Feature(XRayInstrumentOption);
+      Feature += " on ";
+      Feature += Triple.getArchName().data();
+      D.Diag(diag::err_drv_clang_unsupported) << Feature;
+      break;
+    } }
+    CmdArgs.push_back(XRayInstrumentOption);
     if (const Arg *A =
             Args.getLastArg(options::OPT_fxray_instruction_threshold_,
                             options::OPT_fxray_instruction_threshold_EQ)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24799.73509.patch
Type: text/x-patch
Size: 1823 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161004/7ec77e73/attachment.bin>


More information about the cfe-commits mailing list