[PATCH] D120381: [SPARC] Add isSparc for SPARC

Xiaodong Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 23 18:43:05 PST 2022


XiaodongLoong updated this revision to Diff 410990.
XiaodongLoong added a comment.

update code for review comments.
rebase code.


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
@@ -76,6 +76,7 @@
     sparc,          // Sparc: sparc
     sparcv9,        // Sparcv9: Sparcv9
     sparcel,        // Sparc: (endianness = little). NB: 'Sparcle' is a CPU variant
+    sparcv9el,      // Sparcv9: (endianness = little)
     systemz,        // SystemZ: s390x
     tce,            // TCE (http://tce.cs.tut.fi/): tce
     tcele,          // TCE little endian (http://tce.cs.tut.fi/): tcele
@@ -824,6 +825,21 @@
     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 (little and big endian).
+  bool isSPARC64() const {
+    return getArch() == Triple::sparcv9 || getArch() == Triple::sparcv9el;
+  }
+
+  /// 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.410990.patch
Type: text/x-patch
Size: 1276 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220224/8ba15b91/attachment.bin>


More information about the llvm-commits mailing list