[PATCH] Move some ARM-specific code from CGCall.cpp to TargetInfo.cpp

Reid Kleckner rnk at google.com
Tue Aug 26 11:39:04 PDT 2014


lgtm

================
Comment at: lib/CodeGen/CGCall.cpp:1655-1657
@@ -1673,7 +1654,5 @@
 
       // If the coerce-to type is a first class aggregate, we flatten it and
       // pass the elements. Either way is semantically identical, but fast-isel
       // and the optimizer generally likes scalar values better than FCAs.
       llvm::StructType *STy = dyn_cast<llvm::StructType>(ArgI.getCoerceToType());
----------------
It sounds like this comment, particularly the part about them being semantically identical, is no longer true. It sounds like the ARM backend now pattern matches for HFAs and passes them differently. Can you please fix up the comment to reflect the current reality?

================
Comment at: lib/CodeGen/CGCall.cpp:1659-1660
@@ -1679,3 +1658,4 @@
       llvm::StructType *STy = dyn_cast<llvm::StructType>(ArgI.getCoerceToType());
-      if (!isAAPCSVFP(FI, getTarget()) && STy && STy->getNumElements() > 1) {
+      if (ArgI.isDirect() && ArgI.getCanBeFlattened() && STy &&
+          STy->getNumElements() > 1) {
         uint64_t SrcSize = CGM.getDataLayout().getTypeAllocSize(STy);
----------------
Personally, I don't think we should flatten 'Direct' arguments. Chris Lattner added this functionality long ago in 2010. I think such arguments should probably be changed to use 'Expand', but that's a much larger project.

================
Comment at: lib/CodeGen/TargetInfo.cpp:4714
@@ -4701,3 +4713,3 @@
     if (Size <= 8)
-      return ABIArgInfo::getDirect(llvm::Type::getInt8Ty(getVMContext()));
+      return ABIArgInfo::getDirect(llvm::Type::getInt8Ty(getVMContext()), 0, nullptr, !isAAPCS_VFP);
     if (Size <= 16)
----------------
Needs wrapping

http://reviews.llvm.org/D5063






More information about the cfe-commits mailing list