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;
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);
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;
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;
};
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
/// 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:
else
return ExpandFloat;
} else if (VT.getVectorNumElements() == 1) {
- return Scalarize;
+ return ScalarizeVector;
} else {
- return Split;
+ return SplitVector;
}
}
}
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);
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);
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);
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);
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()) {
return;
}
break;
- case Scalarize:
+ case ScalarizeVector:
// Convert the element instead.
SplitInteger(BitConvertToInteger(GetScalarizedVector(InOp)), Lo, Hi);
Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Lo);
// 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();
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!");
// 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();
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!");
// 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!");
case Legal:
case PromoteInteger:
case SoftenFloat:
- case Scalarize:
+ case ScalarizeVector:
break;
case ExpandInteger:
case ExpandFloat:
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);
// 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();
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!");