OSDN Git Service

[SPIR] Simplified target checking.
authorAnastasia Stulova <anastasia.stulova@arm.com>
Thu, 9 May 2019 10:16:33 +0000 (10:16 +0000)
committerAnastasia Stulova <anastasia.stulova@arm.com>
Thu, 9 May 2019 10:16:33 +0000 (10:16 +0000)
Added Triple::isSPIR() helper to simplify code.

Patch by kpet (Kevin Petit)!

Differential revision: https://reviews.llvm.org/D61639

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360323 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/Triple.h

index f2e7a2a..3a7497c 100644 (file)
@@ -671,6 +671,11 @@ public:
            getEnvironment() == Triple::MuslEABIHF;
   }
 
+  /// Tests whether the target is SPIR (32- or 64-bit).
+  bool isSPIR() const {
+    return getArch() == Triple::spir || getArch() == Triple::spir64;
+  }
+
   /// Tests whether the target is NVPTX (32- or 64-bit).
   bool isNVPTX() const {
     return getArch() == Triple::nvptx || getArch() == Triple::nvptx64;