[PATCH] D120381: [Triple] Add llvm::Triple::isSPARC{,32,64}

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 25 13:50:05 PST 2022


MaskRay updated this revision to Diff 411517.
MaskRay retitled this revision from "[SPARC] Add isSPARC* in Triple for SPARC" to "[Triple] Add llvm::Triple::isSPARC{,32,64}".
MaskRay added a comment.

clang-format

update subject


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120381/new/

https://reviews.llvm.org/D120381

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


Index: llvm/include/llvm/ADT/Triple.h
===================================================================
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -824,6 +824,17 @@
     return getArch() == Triple::riscv32 || getArch() == Triple::riscv64;
   }
 
+  /// Tests whether the target is 32-bit SPARC (little and big endian).
+  bool isSPARC32() const {
+    return getArch() == Triple::sparc || getArch() == Triple::sparcel;
+  }
+
+  /// Tests whether the target is 64-bit SPARC (big endian).
+  bool isSPARC64() const { return getArch() == Triple::sparcv9; }
+
+  /// Tests whether the target is SPARC.
+  bool isSPARC() const { return isSPARC32() || isSPARC64(); }
+
   /// Tests whether the target is SystemZ.
   bool isSystemZ() const {
     return getArch() == Triple::systemz;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120381.411517.patch
Type: text/x-patch
Size: 810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220225/87385c61/attachment.bin>


More information about the llvm-commits mailing list