From: Duncan Sands Date: Thu, 10 Jul 2008 15:25:04 +0000 (+0000) Subject: Make the LegalizeType method naming scheme more regular. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f4e4629ee8c218f892ad8ae3e182fe40bc160895;p=oota-llvm.git Make the LegalizeType method naming scheme more regular. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53403 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index 2d7b30d139a..75f50f89294 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -251,11 +251,11 @@ SDOperand DAGTypeLegalizer::PromoteIntRes_BIT_CONVERT(SDNode *N) { case ExpandInteger: case ExpandFloat: break; - case Scalarize: + case ScalarizeVector: // Convert the element to an integer and promote it by hand. return DAG.getNode(ISD::ANY_EXTEND, OutVT, BitConvertToInteger(GetScalarizedVector(InOp))); - case Split: + case SplitVector: // For example, i32 = BIT_CONVERT v2i16 on alpha. Convert the split // pieces of the input into integers and reassemble in the final type. SDOperand Lo, Hi; diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp index 2f5825f0ab4..ed09c6b7124 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp @@ -83,11 +83,11 @@ void DAGTypeLegalizer::run() { case ExpandFloat: ExpandFloatResult(N, i); goto NodeDone; - case Scalarize: - ScalarizeResult(N, i); + case ScalarizeVector: + ScalarizeVectorResult(N, i); goto NodeDone; - case Split: - SplitResult(N, i); + case SplitVector: + SplitVectorResult(N, i); goto NodeDone; } } while (++i < NumResults); @@ -116,11 +116,11 @@ void DAGTypeLegalizer::run() { case ExpandFloat: NeedsRevisit = ExpandFloatOperand(N, i); break; - case Scalarize: - NeedsRevisit = ScalarizeOperand(N, i); + case ScalarizeVector: + NeedsRevisit = ScalarizeVectorOperand(N, i); break; - case Split: - NeedsRevisit = SplitOperand(N, i); + case SplitVector: + NeedsRevisit = SplitVectorOperand(N, i); break; } break; diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/lib/CodeGen/SelectionDAG/LegalizeTypes.h index 8b634b6c5b5..66c696e2e38 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypes.h +++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.h @@ -26,16 +26,10 @@ namespace llvm { //===----------------------------------------------------------------------===// -/// DAGTypeLegalizer - This takes an arbitrary SelectionDAG as input and -/// hacks on it until the target machine can handle it. This involves -/// eliminating value sizes the machine cannot handle (promoting small sizes to -/// large sizes or splitting up large values into small values) as well as -/// eliminating operations the machine cannot handle. -/// -/// This code also does a small amount of optimization and recognition of idioms -/// as part of its processing. For example, if a target does not support a -/// 'setcc' instruction efficiently, but does support 'brcc' instruction, this -/// will attempt merge setcc and brc instructions into brcc's. +/// DAGTypeLegalizer - This takes an arbitrary SelectionDAG as input and hacks +/// on it until only value types the target machine can handle are left. This +/// involves promoting small sizes to large sizes or splitting up large values +/// into small values. /// class VISIBILITY_HIDDEN DAGTypeLegalizer { TargetLowering &TLI; @@ -59,13 +53,13 @@ public: }; private: enum LegalizeAction { - Legal, // The target natively supports this type. - PromoteInteger, // Replace this integer type with a larger one. - ExpandInteger, // Split this integer type into two of half the size. - SoftenFloat, // Convert this float type to a same size integer type. - ExpandFloat, // Split this float type into two of half the size. - Scalarize, // Replace this one-element vector type with its element type. - Split // This vector type should be split into smaller vectors. + Legal, // The target natively supports this type. + PromoteInteger, // Replace this integer type with a larger one. + ExpandInteger, // Split this integer type into two of half the size. + SoftenFloat, // Convert this float type to a same size integer type. + ExpandFloat, // Split this float type into two of half the size. + ScalarizeVector, // Replace this one-element vector with its element type. + SplitVector // This vector type should be split into smaller vectors. }; /// ValueTypeActions - This is a bitvector that contains two bits for each @@ -76,8 +70,8 @@ private: /// getTypeAction - Return how we should legalize values of this type, either /// it is already legal, or we need to promote it to a larger integer type, or /// we need to expand it into multiple registers of a smaller integer type, or - /// we need to scalarize a one-element vector type into the element type, or - /// we need to split a vector type into smaller vector types. + /// we need to split a vector type into smaller vector types, or we need to + /// convert it to a different type of the same size. LegalizeAction getTypeAction(MVT VT) const { switch (ValueTypeActions.getTypeAction(VT)) { default: @@ -99,9 +93,9 @@ private: else return ExpandFloat; } else if (VT.getVectorNumElements() == 1) { - return Scalarize; + return ScalarizeVector; } else { - return Split; + return SplitVector; } } } @@ -400,7 +394,7 @@ private: void SetScalarizedVector(SDOperand Op, SDOperand Result); // Vector Result Scalarization: <1 x ty> -> ty. - void ScalarizeResult(SDNode *N, unsigned OpNo); + void ScalarizeVectorResult(SDNode *N, unsigned OpNo); SDOperand ScalarizeVecRes_BinOp(SDNode *N); SDOperand ScalarizeVecRes_UnaryOp(SDNode *N); @@ -413,7 +407,7 @@ private: SDOperand ScalarizeVecRes_VECTOR_SHUFFLE(SDNode *N); // Vector Operand Scalarization: <1 x ty> -> ty. - bool ScalarizeOperand(SDNode *N, unsigned OpNo); + bool ScalarizeVectorOperand(SDNode *N, unsigned OpNo); SDOperand ScalarizeVecOp_BIT_CONVERT(SDNode *N); SDOperand ScalarizeVecOp_EXTRACT_VECTOR_ELT(SDNode *N); SDOperand ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo); @@ -426,7 +420,7 @@ private: void SetSplitVector(SDOperand Op, SDOperand Lo, SDOperand Hi); // Vector Result Splitting: <128 x ty> -> 2 x <64 x ty>. - void SplitResult(SDNode *N, unsigned OpNo); + void SplitVectorResult(SDNode *N, unsigned OpNo); void SplitVecRes_UNDEF(SDNode *N, SDOperand &Lo, SDOperand &Hi); void SplitVecRes_LOAD(LoadSDNode *N, SDOperand &Lo, SDOperand &Hi); @@ -442,7 +436,7 @@ private: void SplitVecRes_FPOWI(SDNode *N, SDOperand &Lo, SDOperand &Hi); // Vector Operand Splitting: <128 x ty> -> 2 x <64 x ty>. - bool SplitOperand(SDNode *N, unsigned OpNo); + bool SplitVectorOperand(SDNode *N, unsigned OpNo); SDOperand SplitVecOp_BIT_CONVERT(SDNode *N); SDOperand SplitVecOp_EXTRACT_SUBVECTOR(SDNode *N); diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp index d12711a58df..d1606d1d163 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp @@ -54,7 +54,7 @@ void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, SDOperand &Lo, Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Lo); Hi = DAG.getNode(ISD::BIT_CONVERT, NVT, Hi); return; - case Split: + case SplitVector: // Convert the split parts of the input if it was split in two. GetSplitVector(InOp, Lo, Hi); if (Lo.getValueType() == Hi.getValueType()) { @@ -65,7 +65,7 @@ void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, SDOperand &Lo, return; } break; - case Scalarize: + case ScalarizeVector: // Convert the element instead. SplitInteger(BitConvertToInteger(GetScalarizedVector(InOp)), Lo, Hi); Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Lo); diff --git a/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp index fadb938984a..0b00d65943d 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp @@ -27,7 +27,7 @@ using namespace llvm; // Result Vector Scalarization: <1 x ty> -> ty. //===----------------------------------------------------------------------===// -void DAGTypeLegalizer::ScalarizeResult(SDNode *N, unsigned ResNo) { +void DAGTypeLegalizer::ScalarizeVectorResult(SDNode *N, unsigned ResNo) { DEBUG(cerr << "Scalarize node result " << ResNo << ": "; N->dump(&DAG); cerr << "\n"); SDOperand R = SDOperand(); @@ -35,7 +35,7 @@ void DAGTypeLegalizer::ScalarizeResult(SDNode *N, unsigned ResNo) { switch (N->getOpcode()) { default: #ifndef NDEBUG - cerr << "ScalarizeResult #" << ResNo << ": "; + cerr << "ScalarizeVectorResult #" << ResNo << ": "; N->dump(&DAG); cerr << "\n"; #endif assert(0 && "Do not know how to scalarize the result of this operator!"); @@ -147,7 +147,7 @@ SDOperand DAGTypeLegalizer::ScalarizeVecRes_SELECT(SDNode *N) { // Operand Vector Scalarization <1 x ty> -> ty. //===----------------------------------------------------------------------===// -bool DAGTypeLegalizer::ScalarizeOperand(SDNode *N, unsigned OpNo) { +bool DAGTypeLegalizer::ScalarizeVectorOperand(SDNode *N, unsigned OpNo) { DEBUG(cerr << "Scalarize node operand " << OpNo << ": "; N->dump(&DAG); cerr << "\n"); SDOperand Res = SDOperand(); @@ -156,7 +156,7 @@ bool DAGTypeLegalizer::ScalarizeOperand(SDNode *N, unsigned OpNo) { switch (N->getOpcode()) { default: #ifndef NDEBUG - cerr << "ScalarizeOperand Op #" << OpNo << ": "; + cerr << "ScalarizeVectorOperand Op #" << OpNo << ": "; N->dump(&DAG); cerr << "\n"; #endif assert(0 && "Do not know how to scalarize this operator's operand!"); @@ -222,19 +222,19 @@ SDOperand DAGTypeLegalizer::ScalarizeVecOp_STORE(StoreSDNode *N, unsigned OpNo){ // Result Vector Splitting //===----------------------------------------------------------------------===// -/// SplitResult - This method is called when the specified result of the +/// SplitVectorResult - This method is called when the specified result of the /// specified node is found to need vector splitting. At this point, the node /// may also have invalid operands or may have other results that need /// legalization, we just know that (at least) one result needs vector /// splitting. -void DAGTypeLegalizer::SplitResult(SDNode *N, unsigned ResNo) { +void DAGTypeLegalizer::SplitVectorResult(SDNode *N, unsigned ResNo) { DEBUG(cerr << "Split node result: "; N->dump(&DAG); cerr << "\n"); SDOperand Lo, Hi; switch (N->getOpcode()) { default: #ifndef NDEBUG - cerr << "SplitResult #" << ResNo << ": "; + cerr << "SplitVectorResult #" << ResNo << ": "; N->dump(&DAG); cerr << "\n"; #endif assert(0 && "Do not know how to split the result of this operator!"); @@ -456,7 +456,7 @@ void DAGTypeLegalizer::SplitVecRes_BIT_CONVERT(SDNode *N, SDOperand &Lo, case Legal: case PromoteInteger: case SoftenFloat: - case Scalarize: + case ScalarizeVector: break; case ExpandInteger: case ExpandFloat: @@ -472,7 +472,7 @@ void DAGTypeLegalizer::SplitVecRes_BIT_CONVERT(SDNode *N, SDOperand &Lo, return; } break; - case Split: + case SplitVector: // If the input is a vector that needs to be split, convert each split // piece of the input now. GetSplitVector(InOp, Lo, Hi); @@ -529,11 +529,11 @@ void DAGTypeLegalizer::SplitVecRes_FPOWI(SDNode *N, SDOperand &Lo, // Operand Vector Splitting //===----------------------------------------------------------------------===// -/// SplitOperand - This method is called when the specified operand of the +/// SplitVectorOperand - This method is called when the specified operand of the /// specified node is found to need vector splitting. At this point, all of the /// result types of the node are known to be legal, but other operands of the /// node may need legalization as well as the specified one. -bool DAGTypeLegalizer::SplitOperand(SDNode *N, unsigned OpNo) { +bool DAGTypeLegalizer::SplitVectorOperand(SDNode *N, unsigned OpNo) { DEBUG(cerr << "Split node operand: "; N->dump(&DAG); cerr << "\n"); SDOperand Res = SDOperand(); @@ -541,7 +541,7 @@ bool DAGTypeLegalizer::SplitOperand(SDNode *N, unsigned OpNo) { switch (N->getOpcode()) { default: #ifndef NDEBUG - cerr << "SplitOperand Op #" << OpNo << ": "; + cerr << "SplitVectorOperand Op #" << OpNo << ": "; N->dump(&DAG); cerr << "\n"; #endif assert(0 && "Do not know how to split this operator's operand!");