[clang] 5c8755f - [RISCV] Use Triple::isRISCV64(). NFC

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 9 14:03:14 PST 2023


Author: Craig Topper
Date: 2023-12-09T14:02:58-08:00
New Revision: 5c8755f9f40e5b5f4e26a9a0fdb4993cb8a57202

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

LOG: [RISCV] Use Triple::isRISCV64(). NFC

Added: 
    

Modified: 
    clang/lib/Basic/Targets/RISCV.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp
index 13f934e9947212..1a4300e16ce7b3 100644
--- a/clang/lib/Basic/Targets/RISCV.cpp
+++ b/clang/lib/Basic/Targets/RISCV.cpp
@@ -131,7 +131,7 @@ static unsigned getVersionValue(unsigned MajorVersion, unsigned MinorVersion) {
 void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts,
                                        MacroBuilder &Builder) const {
   Builder.defineMacro("__riscv");
-  bool Is64Bit = getTriple().getArch() == llvm::Triple::riscv64;
+  bool Is64Bit = getTriple().isRISCV64();
   Builder.defineMacro("__riscv_xlen", Is64Bit ? "64" : "32");
   StringRef CodeModel = getTargetOpts().CodeModel;
   unsigned FLen = ISAInfo->getFLen();
@@ -281,7 +281,7 @@ bool RISCVTargetInfo::initFeatureMap(
 
   unsigned XLen = 32;
 
-  if (getTriple().getArch() == llvm::Triple::riscv64) {
+  if (getTriple().isRISCV64()) {
     Features["64bit"] = true;
     XLen = 64;
   } else {
@@ -336,7 +336,7 @@ RISCVTargetInfo::getVScaleRange(const LangOptions &LangOpts) const {
 
 /// Return true if has this feature, need to sync with handleTargetFeatures.
 bool RISCVTargetInfo::hasFeature(StringRef Feature) const {
-  bool Is64Bit = getTriple().getArch() == llvm::Triple::riscv64;
+  bool Is64Bit = getTriple().isRISCV64();
   auto Result = llvm::StringSwitch<std::optional<bool>>(Feature)
                     .Case("riscv", true)
                     .Case("riscv32", !Is64Bit)


        


More information about the cfe-commits mailing list