diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-09 00:06:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-09 00:06:19 +0000 |
commit | ff354112b235304b9751448f0134d8364d7914b2 (patch) | |
tree | 631ff1889229dd6b1d19b6f115ce558c1347a702 /lib/CodeGen | |
parent | 0fe34c2912244200daa48d60e845f4fcf669e007 (diff) | |
download | external_llvm-ff354112b235304b9751448f0134d8364d7914b2.zip external_llvm-ff354112b235304b9751448f0134d8364d7914b2.tar.gz external_llvm-ff354112b235304b9751448f0134d8364d7914b2.tar.bz2 |
Add support for splitting the operand of a return instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44728 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypes.h | 3 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp | 52 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp | 19 |
3 files changed, 21 insertions, 53 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/lib/CodeGen/SelectionDAG/LegalizeTypes.h index 0ecc70f..e3d6c74 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypes.h +++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.h @@ -291,7 +291,8 @@ private: // Operand Vector Scalarization: <128 x ty> -> 2 x <64 x ty>. bool SplitOperand(SDNode *N, unsigned OpNo); - SDOperand SplitOperand_STORE(StoreSDNode *N, unsigned OpNo); + SDOperand SplitOp_STORE(StoreSDNode *N, unsigned OpNo); + SDOperand SplitOp_RET(SDNode *N, unsigned OpNo); }; } // end namespace llvm. diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp index ca61dae..15401fe 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp @@ -1043,59 +1043,15 @@ SDOperand DAGTypeLegalizer::ExpandOperand_STORE(StoreSDNode *N, unsigned OpNo) { if (!N->isTruncatingStore()) { unsigned IncrementSize = 0; + GetExpandedOp(N->getValue(), Lo, Hi); + IncrementSize = MVT::getSizeInBits(Hi.getValueType())/8; - // If this is a vector type, then we have to calculate the increment as - // the product of the element size in bytes, and the number of elements - // in the high half of the vector. - if (MVT::isVector(N->getValue().getValueType())) { - assert(0 && "Vectors not supported yet"); - #if 0 - SDNode *InVal = ST->getValue().Val; - unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(0)); - MVT::ValueType EVT = MVT::getVectorElementType(InVal->getValueType(0)); - - // Figure out if there is a simple type corresponding to this Vector - // type. If so, convert to the vector type. - MVT::ValueType TVT = MVT::getVectorType(EVT, NumElems); - if (TLI.isTypeLegal(TVT)) { - // Turn this into a normal store of the vector type. - Tmp3 = LegalizeOp(Node->getOperand(1)); - Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), - SVOffset, isVolatile, Alignment); - Result = LegalizeOp(Result); - break; - } else if (NumElems == 1) { - // Turn this into a normal store of the scalar type. - Tmp3 = ScalarizeVectorOp(Node->getOperand(1)); - Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), - SVOffset, isVolatile, Alignment); - // The scalarized value type may not be legal, e.g. it might require - // promotion or expansion. Relegalize the scalar store. - return LegalizeOp(Result); - } else { - SplitVectorOp(Node->getOperand(1), Lo, Hi); - IncrementSize = NumElems/2 * MVT::getSizeInBits(EVT)/8; - } - #endif - } else { - GetExpandedOp(N->getValue(), Lo, Hi); - IncrementSize = Hi.Val ? MVT::getSizeInBits(Hi.getValueType())/8 : 0; - - if (!TLI.isLittleEndian()) - std::swap(Lo, Hi); - } + if (!TLI.isLittleEndian()) + std::swap(Lo, Hi); Lo = DAG.getStore(Ch, Lo, Ptr, N->getSrcValue(), SVOffset, isVolatile, Alignment); - assert(Hi.Val && "FIXME: int <-> float should be handled with promote!"); - #if 0 - if (Hi.Val == NULL) { - // Must be int <-> float one-to-one expansion. - return Lo; - } - #endif - Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, getIntPtrConstant(IncrementSize)); assert(isTypeLegal(Ptr.getValueType()) && "Pointers must be legal!"); diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp index c16b051..c77bf12 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp @@ -337,9 +337,8 @@ bool DAGTypeLegalizer::SplitOperand(SDNode *N, unsigned OpNo) { #endif assert(0 && "Do not know how to split this operator's operand!"); abort(); - case ISD::STORE: - Res = SplitOperand_STORE(cast<StoreSDNode>(N), OpNo); - break; + case ISD::STORE: Res = SplitOp_STORE(cast<StoreSDNode>(N), OpNo); break; + case ISD::RET: Res = SplitOp_RET(N, OpNo); break; } } @@ -364,7 +363,7 @@ bool DAGTypeLegalizer::SplitOperand(SDNode *N, unsigned OpNo) { return false; } -SDOperand DAGTypeLegalizer::SplitOperand_STORE(StoreSDNode *N, unsigned OpNo) { +SDOperand DAGTypeLegalizer::SplitOp_STORE(StoreSDNode *N, unsigned OpNo) { assert(OpNo == 1 && "Can only split the stored value"); SDOperand Ch = N->getChain(); @@ -388,3 +387,15 @@ SDOperand DAGTypeLegalizer::SplitOperand_STORE(StoreSDNode *N, unsigned OpNo) { return DAG.getNode(ISD::TokenFactor, MVT::Other, Lo, Hi); } +SDOperand DAGTypeLegalizer::SplitOp_RET(SDNode *N, unsigned OpNo) { + assert(N->getNumOperands() == 3 &&"Can only handle ret of one vector so far"); + // FIXME: Returns of gcc generic vectors larger than a legal vector + // type should be returned by reference! + SDOperand Lo, Hi; + GetSplitOp(N->getOperand(1), Lo, Hi); + + SDOperand Chain = N->getOperand(0); // The chain. + SDOperand Sign = N->getOperand(2); // Signness + + return DAG.getNode(ISD::RET, MVT::Other, Chain, Lo, Sign, Hi, Sign); +} |