[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Aug 25 17:24:10 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.171 -> 1.172
---
Log message:

Add support for targets that want to custom expand select_cc in some cases.


---
Diffs of the changes:  (+24 -6)

 LegalizeDAG.cpp |   30 ++++++++++++++++++++++++------
 1 files changed, 24 insertions(+), 6 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.171 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.172
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.171	Thu Aug 25 19:14:16 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Thu Aug 25 19:23:59 2005
@@ -1113,12 +1113,30 @@
     Tmp4 = LegalizeOp(Node->getOperand(3));   // False
     
     if (isTypeLegal(Node->getOperand(0).getValueType())) {
-      Tmp1 = LegalizeOp(Node->getOperand(0));   // LHS
-      Tmp2 = LegalizeOp(Node->getOperand(1));   // RHS
-      if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1) ||
-          Tmp3 != Node->getOperand(2) || Tmp4 != Node->getOperand(3)) {
-        Result = DAG.getNode(ISD::SELECT_CC, Node->getValueType(0), Tmp1, Tmp2, 
-                             Tmp3, Tmp4, Node->getOperand(4));
+      // Everything is legal, see if we should expand this op or something.
+      switch (TLI.getOperationAction(ISD::SELECT_CC,
+                                     Node->getOperand(0).getValueType())) {
+      default: assert(0 && "This action is not supported yet!");
+      case TargetLowering::Custom: {
+        SDOperand Tmp =
+          TLI.LowerOperation(DAG.getNode(ISD::SELECT_CC, Node->getValueType(0),
+                                         Node->getOperand(0),
+                                         Node->getOperand(1), Tmp3, Tmp4,
+                                         Node->getOperand(5)), DAG);
+        if (Tmp.Val) {
+          Result = LegalizeOp(Tmp);
+          break;
+        }
+      } // FALLTHROUGH if the target can't lower this operation after all.
+      case TargetLowering::Legal:
+        Tmp1 = LegalizeOp(Node->getOperand(0));   // LHS
+        Tmp2 = LegalizeOp(Node->getOperand(1));   // RHS
+        if (Tmp1 != Node->getOperand(0) || Tmp2 != Node->getOperand(1) ||
+            Tmp3 != Node->getOperand(2) || Tmp4 != Node->getOperand(3)) {
+          Result = DAG.getNode(ISD::SELECT_CC, Node->getValueType(0), Tmp1, Tmp2, 
+                               Tmp3, Tmp4, Node->getOperand(4));
+        }
+        break;
       }
       break;
     } else {






More information about the llvm-commits mailing list