[PATCH] D12346: x32. Fixes a bug in how struct va_list is initialized in x32

H.J Lu via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 18:57:08 PDT 2015


hjl.tools added a subscriber: hjl.tools.
hjl.tools added a comment.

You missed:

tatic SDValue LowerVACOPY(SDValue Op, const X86Subtarget *Subtarget,

                           SelectionDAG &DAG) {
  // X86-64 va_list is a struct { i32, i32, i8*, i8* }, except on Windows,
  // where a va_list is still an i8*.
  assert(Subtarget->is64Bit() && "This code only handles 64-bit va_copy!");
  if (Subtarget->isCallingConvWin64(
        DAG.getMachineFunction().getFunction()->getCallingConv()))
    // Probably a Win64 va_copy.
    return DAG.expandVACopy(Op.getNode());
  
  SDValue Chain = Op.getOperand(0);
  SDValue DstPtr = Op.getOperand(1);
  SDValue SrcPtr = Op.getOperand(2);
  const Value *DstSV = cast<SrcValueSDNode>(Op.getOperand(3))->getValue();
  const Value *SrcSV = cast<SrcValueSDNode>(Op.getOperand(4))->getValue();
  SDLoc DL(Op);
  
  return DAG.getMemcpy(Chain, DL, DstPtr, SrcPtr,
                       DAG.getIntPtrConstant(24, DL), 8, /*isVolatile*/false,
                                                            ^^^ It should be 16 for x32.
                       false, false,
                       MachinePointerInfo(DstSV), MachinePointerInfo(SrcSV));


http://reviews.llvm.org/D12346





More information about the llvm-commits mailing list