diff options
author | Chris Lattner <sabre@nondot.org> | 2005-12-17 23:46:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-12-17 23:46:46 +0000 |
commit | 181b7a382fbdd3d03ce373a6ffac2204e763f9c3 (patch) | |
tree | 7e26291c5f9fe86ae3fa388d3b77d3b32239213c /lib/CodeGen | |
parent | 294974bd576c381d66af6e73159d0574af81d405 (diff) |
allow custom expansion of BR_CC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24804 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index dae6af4f56..16ef90c251 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/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: |