summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-12-17 23:46:46 +0000
committerChris Lattner <sabre@nondot.org>2005-12-17 23:46:46 +0000
commitbf0bd99e03cdcd22eadfcb7a9ca4c9003150af3c (patch)
tree4d2f2ebb3ea6796a20de5e48b632804172e91a7a
parent5a6b03c1b8a7e1de07ceb9221f088f412368fa7f (diff)
downloadbcm5719-llvm-bf0bd99e03cdcd22eadfcb7a9ca4c9003150af3c.tar.gz
bcm5719-llvm-bf0bd99e03cdcd22eadfcb7a9ca4c9003150af3c.zip
allow custom expansion of BR_CC
llvm-svn: 24804
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index dae6af4f563..16ef90c2515 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -879,17 +879,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
break;
case ISD::BR_CC:
Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain.
-
- if (isTypeLegal(Node->getOperand(2).getValueType())) {
- Tmp2 = LegalizeOp(Node->getOperand(2)); // LHS
- Tmp3 = LegalizeOp(Node->getOperand(3)); // RHS
- if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(2) ||
- Tmp3 != Node->getOperand(3)) {
- Result = DAG.getNode(ISD::BR_CC, MVT::Other, Tmp1, Node->getOperand(1),
- Tmp2, Tmp3, Node->getOperand(4));
- }
- break;
- } else {
+ if (!isTypeLegal(Node->getOperand(2).getValueType())) {
Tmp2 = LegalizeOp(DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(),
Node->getOperand(2), // LHS
Node->getOperand(3), // RHS
@@ -908,6 +898,30 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
Tmp2, DAG.getConstant(0, Tmp2.getValueType()),
Node->getOperand(4));
}
+ break;
+ }
+
+ Tmp2 = LegalizeOp(Node->getOperand(2)); // LHS
+ Tmp3 = LegalizeOp(Node->getOperand(3)); // RHS
+
+ switch (TLI.getOperationAction(ISD::BR_CC, Tmp3.getValueType())) {
+ default: assert(0 && "Unexpected action for BR_CC!");
+ case TargetLowering::Custom: {
+ Tmp4 = DAG.getNode(ISD::BR_CC, MVT::Other, Tmp1, Node->getOperand(1),
+ Tmp2, Tmp3, Node->getOperand(4));
+ Tmp4 = TLI.LowerOperation(Tmp4, DAG);
+ if (Tmp4.Val) {
+ Result = LegalizeOp(Tmp4);
+ break;
+ }
+ } // FALLTHROUGH if the target doesn't want to lower this op after all.
+ case TargetLowering::Legal:
+ if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(2) ||
+ Tmp3 != Node->getOperand(3)) {
+ Result = DAG.getNode(ISD::BR_CC, MVT::Other, Tmp1, Node->getOperand(1),
+ Tmp2, Tmp3, Node->getOperand(4));
+ }
+ break;
}
break;
case ISD::BRCONDTWOWAY:
OpenPOWER on IntegriCloud