diff options
author | Dan Gohman <gohman@apple.com> | 2008-05-10 01:26:14 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-05-10 01:26:14 +0000 |
commit | 3c0e11af643e2d4cd14e9fc7fc0fd3746c394159 (patch) | |
tree | 0f77076b4feb5042d2dcb7f6cf5d43803d548d12 /llvm | |
parent | da2587cedca070c2eb233cd74a6e67c517877aae (diff) | |
download | llvm-3c0e11af643e2d4cd14e9fc7fc0fd3746c394159.zip llvm-3c0e11af643e2d4cd14e9fc7fc0fd3746c394159.tar.gz llvm-3c0e11af643e2d4cd14e9fc7fc0fd3746c394159.tar.bz2 |
For now, abort when an ISD::VAARG is encountered on x86-64, rather
than silently generate invalid code.
llvm-gcc does not currently use VAArgInst; it lowers va_arg in the
front-end.
llvm-svn: 50930
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 20 | ||||
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.h | 1 |
2 files changed, 18 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index b30a13c..d2d7667 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -327,12 +327,14 @@ X86TargetLowering::X86TargetLowering(TargetMachine &TM) // VASTART needs to be custom lowered to use the VarArgsFrameIndex setOperationAction(ISD::VASTART , MVT::Other, Custom); - setOperationAction(ISD::VAARG , MVT::Other, Expand); setOperationAction(ISD::VAEND , MVT::Other, Expand); - if (Subtarget->is64Bit()) + if (Subtarget->is64Bit()) { + setOperationAction(ISD::VAARG , MVT::Other, Custom); setOperationAction(ISD::VACOPY , MVT::Other, Custom); - else + } else { + setOperationAction(ISD::VAARG , MVT::Other, Expand); setOperationAction(ISD::VACOPY , MVT::Other, Expand); + } setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand); @@ -4976,6 +4978,17 @@ SDOperand X86TargetLowering::LowerVASTART(SDOperand Op, SelectionDAG &DAG) { return DAG.getNode(ISD::TokenFactor, MVT::Other, &MemOps[0], MemOps.size()); } +SDOperand X86TargetLowering::LowerVAARG(SDOperand Op, SelectionDAG &DAG) { + // X86-64 va_list is a struct { i32, i32, i8*, i8* }. + assert(Subtarget->is64Bit() && "This code only handles 64-bit va_arg!"); + SDOperand Chain = Op.getOperand(0); + SDOperand SrcPtr = Op.getOperand(1); + SDOperand SrcSV = Op.getOperand(2); + + assert(0 && "VAArgInst is not yet implemented for x86-64!"); + abort(); +} + SDOperand X86TargetLowering::LowerVACOPY(SDOperand Op, SelectionDAG &DAG) { // X86-64 va_list is a struct { i32, i32, i8*, i8* }. assert(Subtarget->is64Bit() && "This code only handles 64-bit va_copy!"); @@ -5598,6 +5611,7 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { case ISD::RET: return LowerRET(Op, DAG); case ISD::FORMAL_ARGUMENTS: return LowerFORMAL_ARGUMENTS(Op, DAG); case ISD::VASTART: return LowerVASTART(Op, DAG); + case ISD::VAARG: return LowerVAARG(Op, DAG); case ISD::VACOPY: return LowerVACOPY(Op, DAG); case ISD::INTRINSIC_WO_CHAIN: return LowerINTRINSIC_WO_CHAIN(Op, DAG); case ISD::RETURNADDR: return LowerRETURNADDR(Op, DAG); diff --git a/llvm/lib/Target/X86/X86ISelLowering.h b/llvm/lib/Target/X86/X86ISelLowering.h index f42ff39..060a1f5 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.h +++ b/llvm/lib/Target/X86/X86ISelLowering.h @@ -517,6 +517,7 @@ namespace llvm { SDOperand LowerDYNAMIC_STACKALLOC(SDOperand Op, SelectionDAG &DAG); SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG); SDOperand LowerVASTART(SDOperand Op, SelectionDAG &DAG); + SDOperand LowerVAARG(SDOperand Op, SelectionDAG &DAG); SDOperand LowerVACOPY(SDOperand Op, SelectionDAG &DAG); SDOperand LowerINTRINSIC_WO_CHAIN(SDOperand Op, SelectionDAG &DAG); SDOperand LowerRETURNADDR(SDOperand Op, SelectionDAG &DAG); |