summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-05-27 12:42:55 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-05-27 12:42:55 +0000
commitb5da3f6f98b28afc0c62572c164ffccb4004827f (patch)
tree45096d5c98b9c86d538ea0efb717280876748f90
parent4bc8c718218159fe410462f6e3670e7cb76c0c04 (diff)
downloadllvm-b5da3f6f98b28afc0c62572c164ffccb4004827f.tar.gz
llvm-b5da3f6f98b28afc0c62572c164ffccb4004827f.tar.bz2
llvm-b5da3f6f98b28afc0c62572c164ffccb4004827f.tar.xz
Minor cleanups; add a better explanation for the issue with
BUILD_VECTOR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72469 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp33
1 files changed, 10 insertions, 23 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index 89d2cfc7d3..30dc8355c7 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -111,10 +111,6 @@ public:
void LegalizeDAG();
private:
- /// HandleOp - Legalize, Promote, or Expand the specified operand as
- /// appropriate for its type.
- void HandleOp(SDValue Op);
-
/// LegalizeOp - We know that the specified value has a legal type.
/// Recursively ensure that the operands have legal types, then return the
/// result.
@@ -129,9 +125,6 @@ private:
SDValue ExpandINSERT_VECTOR_ELT(SDValue Vec, SDValue Val,
SDValue Idx, DebugLoc dl);
- /// Useful 16 element vector type that is used to pass operands for widening.
- typedef SmallVector<SDValue, 16> SDValueVector;
-
/// ShuffleWithNarrowerEltType - Return a vector shuffle operation which
/// performs the same shuffe in terms of order or result bytes, but on a type
/// whose vector element type is narrower than the original shuffle type.
@@ -239,7 +232,7 @@ void SelectionDAGLegalize::LegalizeDAG() {
DAG.AssignTopologicalOrder();
for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(),
E = prior(DAG.allnodes_end()); I != next(E); ++I)
- HandleOp(SDValue(I, 0));
+ LegalizeOp(SDValue(I, 0));
// Finally, it's possible the root changed. Get the new root.
SDValue OldRoot = DAG.getRoot();
@@ -336,22 +329,10 @@ bool SelectionDAGLegalize::LegalizeAllNodesNotLeadingTo(SDNode *N, SDNode *Dest,
}
// Okay, this node looks safe, legalize it and return false.
- HandleOp(SDValue(N, 0));
+ LegalizeOp(SDValue(N, 0));
return false;
}
-/// HandleOp - Legalize, Promote, Widen, or Expand the specified operand as
-/// appropriate for its type.
-void SelectionDAGLegalize::HandleOp(SDValue Op) {
- // Don't touch TargetConstants
- if (Op.getOpcode() == ISD::TargetConstant)
- return;
- MVT VT = Op.getValueType();
- // We should never see any illegal result types here.
- assert(isTypeLegal(VT) && "Illegal type introduced after type legalization?");
- (void)LegalizeOp(Op);
-}
-
/// ExpandConstantFP - Expands the ConstantFP node to an integer constant or
/// a load from the constant pool.
static SDValue ExpandConstantFP(ConstantFPSDNode *CFP, bool UseCP,
@@ -800,8 +781,14 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
Action = TargetLowering::Custom;
break;
case ISD::BUILD_VECTOR:
- // A weird case: when a BUILD_VECTOR is custom-lowered, it doesn't legalize
- // its operands first!
+ // A weird case: legalization for BUILD_VECTOR never legalizes the
+ // operands!
+ // FIXME: This really sucks... changing it isn't semantically incorrect,
+ // but it massively pessimizes the code for floating-point BUILD_VECTORs
+ // because ConstantFP operands get legalized into constant pool loads
+ // before the BUILD_VECTOR code can see them. It doesn't usually bite,
+ // though, because BUILD_VECTORS usually get lowered into other nodes
+ // which get legalized properly.
SimpleFinishLegalizing = false;
break;
default: