diff options
author | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-01-21 04:48:39 +0000 |
---|---|---|
committer | Sanjiv Gupta <sanjiv.gupta@microchip.com> | 2009-01-21 04:48:39 +0000 |
commit | bb326bbe88d0b243d5d9d224308eb0c028d4d4af (patch) | |
tree | 486e8212b2b22ffda1dca927fe145b1449958421 /lib/CodeGen/SelectionDAG/LegalizeTypes.cpp | |
parent | aaf414c92c0247025d6cf31f684895fad7b4c293 (diff) |
Allow targets to legalize operations (with illegal operands) that produces multiple values. For example, a load with an illegal operand (a load produces two values, a value and chain).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62663 91177308-0d34-0410-b5e6-96231b3b80d8
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; |