[PATCH] D91147: AArch64: classify Triple::aarch64_32 as AArch64

Tim Northover via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 13 02:33:51 PST 2020


t.p.northover added inline comments.


================
Comment at: clang/lib/Driver/ToolChain.cpp:1066
   if (getTriple().getArch() == llvm::Triple::x86_64 ||
-      getTriple().isAArch64() || getTriple().isRISCV())
+      (getTriple().isAArch64() && getTriple().isArch64Bit()) ||
+      getTriple().isRISCV())
----------------
dexonsmith wrote:
> Is there a short-form we'd want for this?
> 
> Here are two ideas:
> ```
> // getTriple().isAArch64_64() and getTriple().isAArch64_32()
> bool Triple::isAArch64_64() { return isAArch64() && isArch64Bit(); }
> bool Triple::isAArch64_32() { return isAArch64() && isArch32Bit(); }
> 
> // getTriple().isAArch64(64) and getTriple().isAArch64(32)
> bool Triple::isAArch64(int Bits) {
>   assert(Bits == 32 || Bits == 64);
>   if (!isAArch64())
>     return false;
>   return isArch64Bit() ? Bits == 64 : Bits == 32;
> }
> ```
> Or do you think it's better as-is?
Tricky one. The bare "64" and "32" are a bit non-descript, but having both `isAArch64` and `isArch64` in the same line seems just slightly worse to me so I'll update the patch.


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

https://reviews.llvm.org/D91147



More information about the cfe-commits mailing list