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

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 23 06:58:47 PST 2022


ro added a comment.

Looking at existing cases of comparisons with `Triple::sparc` and `Triple::sparcv9`, I guess we should have `isSPARC32` and `isSPARC64`, too, like `isMIPS32`/`isMIPS64` and `isPPC32`/`isPPC64`.  When switching to `isSPARC*` from existing `Triple::sparc*` comparisons, one will have to be extra careful if they are meant to mean `SPARC` in general or 32-bit `SPARC` in particular.  little-endian `SPARC` is another beast altogether: I didn't even know it existed beyond the ability of `SPARCV9` CPUs to partially run in LE mode, so it will be hard to tell if LE `SPARC` is to be included.  I guess only code review and testing by interested parties can tell.



================
Comment at: llvm/include/llvm/ADT/Triple.h:828
+  /// Tests whether the target is Sparc.
+  bool isSparc() const {
+    return getArch() == Triple::sparc || getArch() == Triple::sparcv9 ||
----------------
I'd go for `isSPARC` instead: `SPARC` is an acronym, like `MIPS`, although LLVM is anything but consistent about the correct capitalization.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120381



More information about the llvm-commits mailing list