diff options
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeTypes.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypes.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp index 330ea86cb0..ff7b8a9563 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp @@ -848,14 +848,28 @@ SDValue DAGTypeLegalizer::CreateStackStoreLoad(SDValue Op, /// CustomLowerResults - Replace the node's results with custom code provided /// by the target and return "true", or do nothing and return "false". -bool DAGTypeLegalizer::CustomLowerResults(SDNode *N, unsigned ResNo) { +/// The last parameter is FALSE if we are dealing with a node with legal +/// result types and illegal operand. The second parameter denotes the illegal +/// OperandNo in that case. +/// The last parameter being TRUE means we are dealing with a +/// node with illegal result types. The second parameter denotes the illegal +/// ResNo in that case. +bool DAGTypeLegalizer::CustomLowerResults(SDNode *N, unsigned Num, + bool LegalizeResult) { + // Get the type of illegal Result or Operand. + MVT ValueTy = (LegalizeResult) ? N->getValueType(Num) + : N->getOperand(Num).getValueType(); + // See if the target wants to custom lower this node. - if (TLI.getOperationAction(N->getOpcode(), N->getValueType(ResNo)) != - TargetLowering::Custom) + if (TLI.getOperationAction(N->getOpcode(), ValueTy) != TargetLowering::Custom) return false; SmallVector<SDValue, 8> Results; - TLI.ReplaceNodeResults(N, Results, DAG); + if (LegalizeResult) + TLI.ReplaceNodeResults(N, Results, DAG); + else + TLI.LowerOperationWrapper(SDValue(N, 0), Results, DAG); + if (Results.empty()) // The target didn't want to custom lower it after all. return false; |