diff options
author | Duncan Sands <baldrick@free.fr> | 2008-10-29 14:25:28 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-10-29 14:25:28 +0000 |
commit | 21c2972f7d24680f6475877a3398b7f8cf515b33 (patch) | |
tree | 5062be89bfa6fba2788afe1503327d34b33dba64 /lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp | |
parent | d22ec5f62813f8cf2ed8091f44a14377209b1a59 (diff) | |
download | external_llvm-21c2972f7d24680f6475877a3398b7f8cf515b33.zip external_llvm-21c2972f7d24680f6475877a3398b7f8cf515b33.tar.gz external_llvm-21c2972f7d24680f6475877a3398b7f8cf515b33.tar.bz2 |
Fix PR2977: LegalizeTypes support for expanding
VAARG.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp index bf86ce2..0a62956 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp @@ -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. |