[llvm] b2f31ca - [Triple] Add llvm::Triple::isRISCV{32,64}

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 13 18:51:39 PDT 2022


Author: Alexey Baturo
Date: 2022-08-13T18:51:35-07:00
New Revision: b2f31cac28c8a03ceb908b544f5790f4f9f2d9ab

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

LOG: [Triple] Add llvm::Triple::isRISCV{32,64}

Reviewed By: vitalybuka, MaskRay, craig.topper

Differential Revision: https://reviews.llvm.org/D131339

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 ba4584dc60faf..bd1a3acdf740a 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -859,10 +859,14 @@ class Triple {
     return getArch() == Triple::ppc64 || getArch() == Triple::ppc64le;
   }
 
+  /// Tests whether the target is 32-bit RISC-V.
+  bool isRISCV32() const { return getArch() == Triple::riscv32; }
+
+  /// Tests whether the target is 64-bit RISC-V.
+  bool isRISCV64() const { return getArch() == Triple::riscv64; }
+
   /// Tests whether the target is RISC-V (32- and 64-bit).
-  bool isRISCV() const {
-    return getArch() == Triple::riscv32 || getArch() == Triple::riscv64;
-  }
+  bool isRISCV() const { return isRISCV32() || isRISCV64(); }
 
   /// Tests whether the target is 32-bit SPARC (little and big endian).
   bool isSPARC32() const {


        


More information about the llvm-commits mailing list