[llvm] 1e8c9e7 - [Triple] Add llvm::Triple::isSPARC{,32,64}
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 25 13:50:38 PST 2022
Author: Xiaodong Liu
Date: 2022-02-25T21:50:34Z
New Revision: 1e8c9e7ac18f6769087219d93b07f76f3574e20a
URL: https://github.com/llvm/llvm-project/commit/1e8c9e7ac18f6769087219d93b07f76f3574e20a
DIFF: https://github.com/llvm/llvm-project/commit/1e8c9e7ac18f6769087219d93b07f76f3574e20a.diff
LOG: [Triple] Add llvm::Triple::isSPARC{,32,64}
Reviewed By: ro, MaskRay
Differential Revision: https://reviews.llvm.org/D120381
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 6cf90fd6eaeee..5e989d5c30fd7 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -824,6 +824,17 @@ class Triple {
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;
More information about the llvm-commits
mailing list