From c08384a3aeeb81646750543cd5637e096d6fc4b1 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 27 Feb 2020 07:49:56 -0800 Subject: [PATCH] [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. --- llvm/include/llvm/ADT/Triple.h | 5 +++++ 1 file changed, 5 insertions(+) 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 @@ 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());