[PATCH] D105555: [RISCV][Clang] Compute the default target-abi if it's empty.
    Jessica Clarke via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Fri Jul 23 08:11:11 PDT 2021
    
    
  
jrtc27 added inline comments.
================
Comment at: clang/lib/Basic/Targets/RISCV.cpp:235
+    bool Is64Bit = getTriple().getArch() == llvm::Triple::riscv64;
+    ABI = llvm::RISCV::computeDefaultABIFromArch(ISAInfo, Is64Bit).str();
+  }
----------------
The ISAInfo includes XLen
================
Comment at: clang/lib/Driver/ToolChains/Arch/RISCV.cpp:202
+    return llvm::RISCV::computeDefaultABIFromArch(ISAInfo,
+                                                  /*IsRV64=*/XLen == 64);
   }
----------------
Ditto (it's literally on the line above!)
================
Comment at: llvm/lib/Support/TargetParser.cpp:336
+                                    bool Is64Bit) {
+  bool HasD = ISAInfo.hasExtension("d");
+  if (!Is64Bit) {
----------------
I'm not personally a fan of having HasD but using ISAInfo.hasExtension("e") in the if. I get why it's done, but I think consistency would be better. Personally I'd just inline the ISAInfo.hasExtension("d"), it's not worth a local variable.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D105555/new/
https://reviews.llvm.org/D105555
    
    
More information about the cfe-commits
mailing list