@@ -327,12 +327,14 @@ X86TargetLowering::X86TargetLowering(TargetMachine &TM)
327
327
328
328
// VASTART needs to be custom lowered to use the VarArgsFrameIndex
329
329
setOperationAction (ISD::VASTART , MVT::Other, Custom);
330
- setOperationAction (ISD::VAARG , MVT::Other, Expand);
331
330
setOperationAction (ISD::VAEND , MVT::Other, Expand);
332
- if (Subtarget->is64Bit ())
331
+ if (Subtarget->is64Bit ()) {
332
+ setOperationAction (ISD::VAARG , MVT::Other, Custom);
333
333
setOperationAction (ISD::VACOPY , MVT::Other, Custom);
334
- else
334
+ } else {
335
+ setOperationAction (ISD::VAARG , MVT::Other, Expand);
335
336
setOperationAction (ISD::VACOPY , MVT::Other, Expand);
337
+ }
336
338
337
339
setOperationAction (ISD::STACKSAVE, MVT::Other, Expand);
338
340
setOperationAction (ISD::STACKRESTORE, MVT::Other, Expand);
@@ -4976,6 +4978,17 @@ SDOperand X86TargetLowering::LowerVASTART(SDOperand Op, SelectionDAG &DAG) {
4976
4978
return DAG.getNode (ISD::TokenFactor, MVT::Other, &MemOps[0 ], MemOps.size ());
4977
4979
}
4978
4980
4981
+ SDOperand X86TargetLowering::LowerVAARG (SDOperand Op, SelectionDAG &DAG) {
4982
+ // X86-64 va_list is a struct { i32, i32, i8*, i8* }.
4983
+ assert (Subtarget->is64Bit () && " This code only handles 64-bit va_arg!" );
4984
+ SDOperand Chain = Op.getOperand (0 );
4985
+ SDOperand SrcPtr = Op.getOperand (1 );
4986
+ SDOperand SrcSV = Op.getOperand (2 );
4987
+
4988
+ assert (0 && " VAArgInst is not yet implemented for x86-64!" );
4989
+ abort ();
4990
+ }
4991
+
4979
4992
SDOperand X86TargetLowering::LowerVACOPY (SDOperand Op, SelectionDAG &DAG) {
4980
4993
// X86-64 va_list is a struct { i32, i32, i8*, i8* }.
4981
4994
assert (Subtarget->is64Bit () && " This code only handles 64-bit va_copy!" );
@@ -5598,6 +5611,7 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) {
5598
5611
case ISD::RET: return LowerRET (Op, DAG);
5599
5612
case ISD::FORMAL_ARGUMENTS: return LowerFORMAL_ARGUMENTS (Op, DAG);
5600
5613
case ISD::VASTART: return LowerVASTART (Op, DAG);
5614
+ case ISD::VAARG: return LowerVAARG (Op, DAG);
5601
5615
case ISD::VACOPY: return LowerVACOPY (Op, DAG);
5602
5616
case ISD::INTRINSIC_WO_CHAIN: return LowerINTRINSIC_WO_CHAIN (Op, DAG);
5603
5617
case ISD::RETURNADDR: return LowerRETURNADDR (Op, DAG);
0 commit comments