[PATCH] Make variable argument intrinsics behave correctly in a Win64 CC function.

Charles Davis cdavis5x at gmail.com
Thu Sep 12 17:16:59 PDT 2013



================
Comment at: lib/Target/X86/X86ISelLowering.cpp:10848
@@ +10847,3 @@
+    // The Win64 ABI uses char* instead of a structure.
+    return DAG.expandVAArg(Op.getNode());
+
----------------
Eli Friedman wrote:
> Checking DAG.getMachineFunction().getFunction()->getCallingConv() is fine for va_start, but it isn't correct for va_arg or va_copy: a function using the Win64 calling convention can pass its va_list to a function using the AMD calling convention, or vice versa.  And even if nobody writes code like that, the optimizer could potentially introduce such constructs.
I've attempted to address this now by having the lowering code for `va_arg` and `va_copy` try to do Win64-style lowering based on the types of the arguments, but I'm not sure if this is the right way to go.


http://llvm-reviews.chandlerc.com/D1622

BRANCH
  x64-ms-va_list

ARCANIST PROJECT
  llvm



More information about the llvm-commits mailing list