[PATCH] D45240: [ARM] Compute a target feature which corresponds to the ARM version.

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 6 11:07:49 PDT 2018


fhahn accepted this revision.
fhahn added a comment.

Thanks for updating it to use the stuff from TargetParser.

LGTM, with tests for the cases @joerg mentiond.



================
Comment at: lib/Basic/Targets/ARM.cpp:345
   // get default FPU features
+  llvm::ARM::ArchKind Arch = llvm::ARM::parseArch(getTriple().getArchName());
   unsigned FPUKind = llvm::ARM::getDefaultFPU(CPU, Arch);
----------------
efriedma wrote:
> fhahn wrote:
> > Is there a reason we re-compute the Arch from the triple here, but use the member variable ArchKind above? Shouldn't they both be the same ?
> ArchKind is based on the triple and the CPU, where "Arch" is just based on the triple, so "Arch" was returning the wrong thing in some cases.
> 
> Actually, looking a bit more, we should probably be calling parseCPUArch here to get the right behavior, rather than depending on the member.  (It doesn't usually matter, but it could make a difference for code using "target" attribute, I guess.  That feature needs a lot more work, though.)
Thanks that makes sense. getDefaultFPU and getDefaultExtensions are only for "generic" FPUs.


Repository:
  rC Clang

https://reviews.llvm.org/D45240





More information about the cfe-commits mailing list