[PATCH] code refactoring on ARMTargetInfo class

Alexandros Lamprineas alexandros.lamprineas at arm.com
Thu Jul 2 02:44:38 PDT 2015


================
Comment at: lib/Basic/Targets.cpp:4160
@@ +4159,3 @@
+    if (Triple.getSubArch() == llvm::Triple::SubArchType::NoSubArch)
+      setArchInfo("armv6j");
+    else 
----------------
rengolin wrote:
> labrinea wrote:
> > rengolin wrote:
> > > This seems quite arbitrary... Couldn't you return an empty string?
> > If no subArch is specified then setArchInfo() cannot do much with an empty string. ArcKind will be set to invalid and getCPUAttr() will return an empty string. A regression will appear since __ARM_ARCH_6J__ won't be defined as expected. That ("armv6j") should be the corresponding subArch for the default CPU ("arm1136j-s") specified in the constructor.
> Then, use the default value in the constructor (CPU) instead, to figure out the arch.
> 
> Don't just hard-code yet another temporarily matching value.
If it is more maintainable instead of setArchInfo("armv6j") we could call setCPU(CPU) (where cpu is "arm1136j-s" by default) in case subArch is not defined.

http://reviews.llvm.org/D10839

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list