X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FSelectionDAG%2FLegalizeTypes.h;h=48d4b391fb5a5d80f7d689e975cb093bf73e2d09;hb=e326332acd5fefb9854118603b4d07d4e44b64c5;hp=1c20969b9dca6eaa55aca8b32649bcfe527417f4;hpb=077f9b20d0e8659d00a09046a63e28edf0665ffe;p=oota-llvm.git diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/lib/CodeGen/SelectionDAG/LegalizeTypes.h index 1c20969b9dc..48d4b391fb5 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypes.h +++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.h @@ -62,6 +62,7 @@ private: Legal, // The target natively supports this type. Promote, // This type should be executed in a larger type. Expand, // This type should be split into two types of half the size. + FloatToInt, // Convert a floating point type to an integer of the same size. Scalarize, // Replace this one-element vector type with its element type. Split // This vector type should be split into smaller vectors. }; @@ -85,14 +86,20 @@ private: case TargetLowering::Promote: return Promote; case TargetLowering::Expand: - // Expand can mean 1) split integer in half 2) scalarize single-element - // vector 3) split vector in two. - if (!MVT::isVector(VT)) - return Expand; - else if (MVT::getVectorNumElements(VT) == 1) + // Expand can mean + // 1) split scalar in half, 2) convert a float to an integer, + // 3) scalarize a single-element vector, 4) split a vector in two. + if (!MVT::isVector(VT)) { + if (MVT::getSizeInBits(VT) == + MVT::getSizeInBits(TLI.getTypeToTransformTo(VT))) + return FloatToInt; + else + return Expand; + } else if (MVT::getVectorNumElements(VT) == 1) { return Scalarize; - else + } else { return Split; + } } } @@ -103,23 +110,27 @@ private: /// PromotedNodes - For nodes that are below legal width, this map indicates /// what promoted value to use. - DenseMap PromotedNodes; + DenseMap PromotedNodes; /// ExpandedNodes - For nodes that need to be expanded this map indicates /// which operands are the expanded version of the input. - DenseMap > ExpandedNodes; + DenseMap > ExpandedNodes; + + /// FloatToIntedNodes - For floating point nodes converted to integers of + /// the same size, this map indicates the converted value to use. + DenseMap FloatToIntedNodes; /// ScalarizedNodes - For nodes that are <1 x ty>, this map indicates the /// scalar value of type 'ty' to use. - DenseMap ScalarizedNodes; + DenseMap ScalarizedNodes; /// SplitNodes - For nodes that need to be split this map indicates /// which operands are the expanded version of the input. - DenseMap > SplitNodes; + DenseMap > SplitNodes; /// ReplacedNodes - For nodes that have been replaced with another, /// indicates the replacement node to use. - DenseMap ReplacedNodes; + DenseMap ReplacedNodes; /// Worklist - This defines a worklist of nodes to process. In order to be /// pushed onto this worklist, all operands of a node must have already been @@ -152,9 +163,13 @@ private: void RemapNode(SDOperand &N); // Common routines. + SDOperand BitConvertToInteger(SDOperand Op); SDOperand CreateStackStoreLoad(SDOperand Op, MVT::ValueType DestVT); SDOperand HandleMemIntrinsic(SDNode *N); - void SplitOp(SDOperand Op, SDOperand &Lo, SDOperand &Hi); + SDOperand JoinIntegers(SDOperand Lo, SDOperand Hi); + void SplitInteger(SDOperand Op, SDOperand &Lo, SDOperand &Hi); + void SplitInteger(SDOperand Op, MVT::ValueType LoVT, MVT::ValueType HiVT, + SDOperand &Lo, SDOperand &Hi); //===--------------------------------------------------------------------===// // Promotion Support: LegalizeTypesPromote.cpp @@ -278,6 +293,28 @@ private: void ExpandSetCCOperands(SDOperand &NewLHS, SDOperand &NewRHS, ISD::CondCode &CCCode); + //===--------------------------------------------------------------------===// + // Float to Integer Conversion Support: LegalizeTypesFloatToInt.cpp + //===--------------------------------------------------------------------===// + + SDOperand GetIntegerOp(SDOperand Op) { + SDOperand &IntegerOp = FloatToIntedNodes[Op]; + RemapNode(IntegerOp); + assert(IntegerOp.Val && "Operand wasn't converted to integer?"); + return IntegerOp; + } + void SetIntegerOp(SDOperand Op, SDOperand Result); + + // Result Float to Integer Conversion. + void FloatToIntResult(SDNode *N, unsigned OpNo); + SDOperand FloatToIntRes_BIT_CONVERT(SDNode *N); + SDOperand FloatToIntRes_BUILD_PAIR(SDNode *N); + SDOperand FloatToIntRes_FCOPYSIGN(SDNode *N); + + // Operand Float to Integer Conversion. + bool FloatToIntOperand(SDNode *N, unsigned OpNo); + SDOperand FloatToIntOp_BIT_CONVERT(SDNode *N); + //===--------------------------------------------------------------------===// // Scalarization Support: LegalizeTypesScalarize.cpp //===--------------------------------------------------------------------===// @@ -333,7 +370,7 @@ private: void SplitRes_FPOWI(SDNode *N, SDOperand &Lo, SDOperand &Hi); void SplitRes_SELECT(SDNode *N, SDOperand &Lo, SDOperand &Hi); - // Operand Vector Scalarization: <128 x ty> -> 2 x <64 x ty>. + // Operand Vector Splitting: <128 x ty> -> 2 x <64 x ty>. bool SplitOperand(SDNode *N, unsigned OpNo); SDOperand SplitOp_BIT_CONVERT(SDNode *N);