[WebAssembly] Add an `isWasm` target triple predicate.
authorDan Gohman <sunfish@mozilla.com>
Thu, 27 Feb 2020 15:49:56 +0000 (07:49 -0800)
committerDan Gohman <sunfish@mozilla.com>
Thu, 27 Feb 2020 15:55:01 +0000 (07:55 -0800)
This simplies code which needs to apply the same logic to both wasm32
and wasm64.

This patch is part of https://reviews.llvm.org/D70700.

llvm/include/llvm/ADT/Triple.h

index 64ba8d7..c136469 100644 (file)
@@ -741,6 +741,11 @@ public:
     return getArch() == Triple::ve;
   }
 
+  /// Tests whether the target is wasm (32- and 64-bit).
+  bool isWasm() const {
+    return getArch() == Triple::wasm32 || getArch() == Triple::wasm64;
+  }
+
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
     return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());