[llvm] c08384a - [WebAssembly] Add an `isWasm` target triple predicate.

Dan Gohman via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 07:55:04 PST 2020


Author: Dan Gohman
Date: 2020-02-27T07:55:01-08:00
New Revision: c08384a3aeeb81646750543cd5637e096d6fc4b1

URL: https://github.com/llvm/llvm-project/commit/c08384a3aeeb81646750543cd5637e096d6fc4b1
DIFF: https://github.com/llvm/llvm-project/commit/c08384a3aeeb81646750543cd5637e096d6fc4b1.diff

LOG: [WebAssembly] Add an `isWasm` target triple predicate.

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.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/Triple.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
index 64ba8d7e21e4..c136469eff54 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -741,6 +741,11 @@ class Triple {
     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());


        


More information about the llvm-commits mailing list