Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.230 -> 1.231 --- Log message: allow custom expansion of BR_CC --- Diffs of the changes: (+25 -11) LegalizeDAG.cpp | 36 +++++++++++++++++++++++++----------- 1 files changed, 25 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.230 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.231 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.230 Fri Dec 16 19:21:05 2005 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sat Dec 17 17:46:46 2005 @@ -879,17 +879,7 @@ 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 @@ 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: _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits