[llvm-commits] [llvm] r60102 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Sanjiv Gupta sanjiv.gupta at microchip.com
Wed Nov 26 03:19:01 PST 2008


Author: sgupta
Date: Wed Nov 26 05:19:00 2008
New Revision: 60102

URL: http://llvm.org/viewvc/llvm-project?rev=60102&view=rev
Log:
Allow custom lowering of ADDE/ADDC/SUBE/SUBC operations.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=60102&r1=60101&r2=60102&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Nov 26 05:19:00 2008
@@ -3299,11 +3299,26 @@
     Tmp1 = LegalizeOp(Node->getOperand(0));
     Tmp2 = LegalizeOp(Node->getOperand(1));
     Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2);
+    Tmp3 = Result.getValue(0);
+    Tmp4 = Result.getValue(1);
+
+    switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
+    default: assert(0 && "This action is not supported yet!");
+    case TargetLowering::Legal:
+      break;
+    case TargetLowering::Custom:
+      Tmp1 = TLI.LowerOperation(Tmp3, DAG);
+      if (Tmp1.getNode() != NULL) {
+        Tmp3 = LegalizeOp(Tmp1);;
+        Tmp4 = LegalizeOp(Tmp1.getValue(1));
+      }
+      break;
+    }
     // Since this produces two values, make sure to remember that we legalized
     // both of them.
-    AddLegalizedOperand(SDValue(Node, 0), Result.getValue(0));
-    AddLegalizedOperand(SDValue(Node, 1), Result.getValue(1));
-    return Result;
+    AddLegalizedOperand(SDValue(Node, 0), Tmp3);
+    AddLegalizedOperand(SDValue(Node, 1), Tmp4);
+    return Op.getResNo() ? Tmp4 : Tmp3;
 
   case ISD::ADDE:
   case ISD::SUBE:
@@ -3311,11 +3326,26 @@
     Tmp2 = LegalizeOp(Node->getOperand(1));
     Tmp3 = LegalizeOp(Node->getOperand(2));
     Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3);
+    Tmp3 = Result.getValue(0);
+    Tmp4 = Result.getValue(1);
+
+    switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
+    default: assert(0 && "This action is not supported yet!");
+    case TargetLowering::Legal:
+      break;
+    case TargetLowering::Custom:
+      Tmp1 = TLI.LowerOperation(Tmp3, DAG);
+      if (Tmp1.getNode() != NULL) {
+        Tmp3 = LegalizeOp(Tmp1);;
+        Tmp4 = LegalizeOp(Tmp1.getValue(1));
+      }
+      break;
+    }
     // Since this produces two values, make sure to remember that we legalized
     // both of them.
-    AddLegalizedOperand(SDValue(Node, 0), Result.getValue(0));
-    AddLegalizedOperand(SDValue(Node, 1), Result.getValue(1));
-    return Result;
+    AddLegalizedOperand(SDValue(Node, 0), Tmp3);
+    AddLegalizedOperand(SDValue(Node, 1), Tmp4);
+    return Op.getResNo() ? Tmp4 : Tmp3;
     
   case ISD::BUILD_PAIR: {
     MVT PairTy = Node->getValueType(0);





More information about the llvm-commits mailing list