[PATCH] D14871: [Power PC] fix calculating address of arguments on stack for variadic functions

John McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 25 14:45:45 PST 2015

rjmccall added inline comments.

Comment at: lib/CodeGen/TargetInfo.cpp:241
@@ +240,3 @@
+  return Address(PtrAsInt, Align);
Thank you for extracting this.

First, this function deserves a doc comment now; I would suggest:

  /// Dynamically round a pointer up to a multiple of the given alignment.

Also, this is now generically useful, so (1) please rename OverflowArgArea to something more generic, like Ptr, and (2) please use LLVM value names based on the name already in Ptr.  That is, instead of "overflow_arg_area.align", please use
  Ptr->getName () + ".aligned"

Finally, please look for the other places in this file that you could change to use this new function.  There's one in emitVoidPtrDirectVAArg, and there are several other in other targets.

Comment at: lib/CodeGen/TargetInfo.cpp:3568
@@ +3567,3 @@
+      OverflowArea = emitRoundPointerUpToAlignment(CGF, OverflowArgArea,
+                                                   Align);
+    }
Please sink OverflowArgArea into the if block, since you don't need it outside.


More information about the cfe-commits mailing list