[PATCH] D27529: Correct Vectorcall Register passing and HVA Behavior

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 4 10:58:32 PST 2017


rnk added inline comments.


================
Comment at: include/clang/CodeGen/CGFunctionInfo.h:136
   }
+  static ABIArgInfo getDirectHva(llvm::Type *T = nullptr) {
+    auto AI = getDirect(T);
----------------
Marking HVAs with inreg is an x86-specific convention. Let's move this down to TargetInfo.cpp and call it something like `getDirectX86HVA` or something.


================
Comment at: include/clang/CodeGen/CGFunctionInfo.h:139
+    AI.setInReg(true);
+    AI.setCanBeFlattened(false);
+    return AI;
----------------
In the long run, I think ABIArgInfo::Direct is too overloaded and needs to be split. The implementation of a single direct argument in EmitFunctionPrologue is *174* lines. It would be much cleaner to make some new ABIArgInfo types instead of having these "can be flattened" flags and things.


================
Comment at: lib/CodeGen/TargetInfo.cpp:1507
-       State.CC == llvm::CallingConv::X86_RegCall) &&
-      isHomogeneousAggregate(Ty, Base, NumElts)) {
-    if (State.FreeSSERegs >= NumElts) {
----------------
You don't seem to do anything in this if block if !IsHva, so maybe fold it back into the initial check like it was, and then break out the case for regcall and vectorcall separately.


================
Comment at: lib/CodeGen/TargetInfo.cpp:1678-1679
+    // HVAs must be done as a second priority for registers, so the deferred
+    // items
+    // are dealt with by going through the pattern a second time.
+    for (auto &I : FI.arguments()) {
----------------
Rewrap this. clang-format breaks comments without re-flowing, since it doesn't know what should flow together.


https://reviews.llvm.org/D27529





More information about the cfe-commits mailing list