summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-08-31 20:13:26 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-08-31 20:13:26 +0000
commitfcd75e5efb482f35cfc22fd4b64e047930130fd6 (patch)
tree334fe23a6a17c7ab3e0ac5f23db117b64a5f64f8 /lib/CodeGen/SelectionDAG
parentd84192fe4f6495e43ee0ff2ac591c14ba36e1e9d (diff)
downloadllvm-fcd75e5efb482f35cfc22fd4b64e047930130fd6.tar.gz
llvm-fcd75e5efb482f35cfc22fd4b64e047930130fd6.tar.bz2
llvm-fcd75e5efb482f35cfc22fd4b64e047930130fd6.tar.xz
Misc cleanup; addresses Duncan's comments on r138877.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138887 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp4
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp7
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypes.cpp15
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypes.h13
4 files changed, 17 insertions, 22 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
index 97658917f7..d0c93a8f51 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
@@ -110,9 +110,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_BITCAST(SDNode *N) {
SDValue DAGTypeLegalizer::SoftenFloatRes_MERGE_VALUES(SDNode *N) {
SDValue Op = DecomposeMERGE_VALUES(N);
- return Op.getValueType().isVector() ?
- BitConvertVectorToIntegerVector(Op) :
- BitConvertToInteger(Op);
+ return BitConvertToInteger(Op);
}
SDValue DAGTypeLegalizer::SoftenFloatRes_BUILD_PAIR(SDNode *N) {
diff --git a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index b0f4c3f2d3..08d6c7237a 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -139,8 +139,6 @@ void DAGTypeLegalizer::PromoteIntegerResult(SDNode *N, unsigned ResNo) {
SDValue DAGTypeLegalizer::PromoteIntRes_MERGE_VALUES(SDNode *N) {
SDValue Op = DecomposeMERGE_VALUES(N);
- assert(Op.getValueType().isInteger()
- && "Must decompose to an integer type!");
return GetPromotedInteger(Op);
}
@@ -1556,11 +1554,10 @@ void DAGTypeLegalizer::ExpandIntRes_ADDSUBE(SDNode *N,
// use the new one.
ReplaceValueWith(SDValue(N, 1), Hi.getValue(1));
}
+
void DAGTypeLegalizer::ExpandIntRes_MERGE_VALUES(SDNode *N,
- SDValue &Lo, SDValue &Hi) {
+ SDValue &Lo, SDValue &Hi) {
SDValue Res = DecomposeMERGE_VALUES(N);
- assert(Res.getValueType().isInteger()
- && "Cannot split a non-integer value.");
SplitInteger(Res, Lo, Hi);
}
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
index af4f356652..04f6642c94 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
@@ -948,21 +948,22 @@ bool DAGTypeLegalizer::CustomWidenLowerNode(SDNode *N, EVT VT) {
SDValue DAGTypeLegalizer::DecomposeMERGE_VALUES(SDNode *N) {
unsigned i;
- // A MERGE_VALUES node can produce any number of values.
- // We know that the first illegal type needs to be handled.
+ // A MERGE_VALUES node can produce any number of values.
+ // Replace the results other than the first illegal one with the
+ // corresponding input operands.
for (i = 0; isTypeLegal(N->getValueType(i)); ++i)
ReplaceValueWith(SDValue(N, i), SDValue(N->getOperand(i)));
- // The first illegal result must be the one that needs to be handled.
- SDValue BadValue = N->getOperand(i);
+ // The first illegal result is the one which needs to be handled;
+ // type legalization legalizes values in order.
+ SDValue IllegalValue = N->getOperand(i);
- // Legalize the rest of the results into the input operands whether they
- // are legal or not.
+ // Continue replacing results.
unsigned e = N->getNumValues();
for (++i; i != e; ++i)
ReplaceValueWith(SDValue(N, i), SDValue(N->getOperand(i)));
- return BadValue;
+ return IllegalValue;
}
/// GetSplitDestVTs - Compute the VTs needed for the low/hi parts of a type
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/lib/CodeGen/SelectionDAG/LegalizeTypes.h
index 23430030e6..6c1226271b 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeTypes.h
+++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.h
@@ -149,10 +149,9 @@ private:
bool CustomLowerNode(SDNode *N, EVT VT, bool LegalizeResult);
bool CustomWidenLowerNode(SDNode *N, EVT VT);
- // DecomposeMERGE_VALUES takes a SDNode and returns the first
- // illegal operand that needs to be modified.
- // All other nodes are legalized, whether they are legal or not.
- // The resulting SDValue needs to be modified to make it legal.
+ // DecomposeMERGE_VALUES takes a SDNode and returns the first
+ // illegal value. All other results are replaced with the
+ // corresponding input operand.
SDValue DecomposeMERGE_VALUES(SDNode *N);
SDValue GetVectorElementPointer(SDValue VecPtr, EVT EltVT, SDValue Index);
@@ -162,9 +161,9 @@ private:
const SDValue *Ops, unsigned NumOps, bool isSigned,
DebugLoc dl);
- std::pair<SDValue, SDValue> ExpandChainLibCall(RTLIB::Libcall LC,
- SDNode *Node, bool isSigned);
- std::pair<SDValue, SDValue> ExpandAtomic(SDNode *Node);
+ std::pair<SDValue, SDValue> ExpandChainLibCall(RTLIB::Libcall LC,
+ SDNode *Node, bool isSigned);
+ std::pair<SDValue, SDValue> ExpandAtomic(SDNode *Node);
SDValue PromoteTargetBoolean(SDValue Bool, EVT VT);
void ReplaceValueWith(SDValue From, SDValue To);