forked from OSchip/llvm-project
Fix PR2977: LegalizeTypes support for expanding
VAARG. llvm-svn: 58379
This commit is contained in:
parent
17e678be87
commit
fbb10bbec4
|
@ -575,6 +575,7 @@ void DAGTypeLegalizer::ExpandFloatResult(SDNode *N, unsigned ResNo) {
|
|||
case ISD::BUILD_PAIR: ExpandRes_BUILD_PAIR(N, Lo, Hi); break;
|
||||
case ISD::EXTRACT_ELEMENT: ExpandRes_EXTRACT_ELEMENT(N, Lo, Hi); break;
|
||||
case ISD::EXTRACT_VECTOR_ELT: ExpandRes_EXTRACT_VECTOR_ELT(N, Lo, Hi); break;
|
||||
case ISD::VAARG: ExpandRes_VAARG(N, Lo, Hi); break;
|
||||
|
||||
case ISD::ConstantFP: ExpandFloatRes_ConstantFP(N, Lo, Hi); break;
|
||||
case ISD::FABS: ExpandFloatRes_FABS(N, Lo, Hi); break;
|
||||
|
|
|
@ -960,6 +960,7 @@ void DAGTypeLegalizer::ExpandIntegerResult(SDNode *N, unsigned ResNo) {
|
|||
case ISD::BUILD_PAIR: ExpandRes_BUILD_PAIR(N, Lo, Hi); break;
|
||||
case ISD::EXTRACT_ELEMENT: ExpandRes_EXTRACT_ELEMENT(N, Lo, Hi); break;
|
||||
case ISD::EXTRACT_VECTOR_ELT: ExpandRes_EXTRACT_VECTOR_ELT(N, Lo, Hi); break;
|
||||
case ISD::VAARG: ExpandRes_VAARG(N, Lo, Hi); break;
|
||||
|
||||
case ISD::ANY_EXTEND: ExpandIntRes_ANY_EXTEND(N, Lo, Hi); break;
|
||||
case ISD::AssertSext: ExpandIntRes_AssertSext(N, Lo, Hi); break;
|
||||
|
|
|
@ -516,6 +516,7 @@ private:
|
|||
void ExpandRes_EXTRACT_ELEMENT (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandRes_NormalLoad (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
void ExpandRes_VAARG (SDNode *N, SDValue &Lo, SDValue &Hi);
|
||||
|
||||
// Generic Operand Expansion.
|
||||
SDValue ExpandOp_BIT_CONVERT (SDNode *N);
|
||||
|
|
|
@ -171,6 +171,23 @@ void DAGTypeLegalizer::ExpandRes_NormalLoad(SDNode *N, SDValue &Lo,
|
|||
ReplaceValueWith(SDValue(N, 1), Chain);
|
||||
}
|
||||
|
||||
void DAGTypeLegalizer::ExpandRes_VAARG(SDNode *N, SDValue &Lo, SDValue &Hi) {
|
||||
MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
|
||||
SDValue Chain = N->getOperand(0);
|
||||
SDValue Ptr = N->getOperand(1);
|
||||
|
||||
Lo = DAG.getVAArg(NVT, Chain, Ptr, N->getOperand(2));
|
||||
Hi = DAG.getVAArg(NVT, Lo.getValue(1), Ptr, N->getOperand(2));
|
||||
|
||||
// Handle endianness of the load.
|
||||
if (TLI.isBigEndian())
|
||||
std::swap(Lo, Hi);
|
||||
|
||||
// Modified the chain - switch anything that used the old chain to use
|
||||
// the new one.
|
||||
ReplaceValueWith(SDValue(N, 1), Hi.getValue(1));
|
||||
}
|
||||
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
// Generic Operand Expansion.
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
; RUN: llvm-as < %s | llc -march=x86
|
||||
; PR2977
|
||||
define i8* @ap_php_conv_p2(){
|
||||
entry:
|
||||
%ap.addr = alloca i8* ; <i8**> [#uses=36]
|
||||
br label %sw.bb301
|
||||
sw.bb301:
|
||||
%0 = va_arg i8** %ap.addr, i64 ; <i64> [#uses=1]
|
||||
br label %sw.bb301
|
||||
}
|
Loading…
Reference in New Issue