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

Andrew Lenharth alenhar2 at cs.uiuc.edu
Sat Dec 24 15:42:44 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.247 -> 1.248
---
Log message:

Support Custom lowering of a few more operations.
Alpha needs to custom lower *DIV and *REM


---
Diffs of the changes:  (+31 -5)

 LegalizeDAG.cpp |   36 +++++++++++++++++++++++++++++++-----
 1 files changed, 31 insertions(+), 5 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.247 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.248
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.247	Fri Dec 23 10:12:20 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Sat Dec 24 17:42:32 2005
@@ -537,6 +537,7 @@
   case ISD::GlobalAddress:
   case ISD::TargetGlobalAddress:
   case ISD::ExternalSymbol:
+  case ISD::TargetExternalSymbol:
   case ISD::ConstantPool:           // Nothing to do.
   case ISD::BasicBlock:
   case ISD::CONDCODE:
@@ -1954,9 +1955,25 @@
       Tmp2 = PromoteOp(Node->getOperand(1));  // Promote the RHS.
       break;
     }
-    if (Tmp1 != Node->getOperand(0) ||
-        Tmp2 != Node->getOperand(1))
-      Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,Tmp2);
+    switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) {
+    case TargetLowering::Legal:
+      if (Tmp1 != Node->getOperand(0) ||
+	  Tmp2 != Node->getOperand(1))
+	Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,Tmp2);
+      break;
+    case TargetLowering::Custom: {
+      Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1, Tmp2);
+      SDOperand Tmp = TLI.LowerOperation(Result, DAG);
+      if (Tmp.Val) {
+	Tmp = LegalizeOp(Tmp);  // Relegalize input.
+	AddLegalizedOperand(Op, Tmp);
+	return Tmp;
+      }
+      break;
+    }
+    default:
+      assert(0 && "Operation not supported");
+    }
     break;
 
   case ISD::BUILD_PAIR: {
@@ -1997,8 +2014,17 @@
                              Tmp2);
       break;
     case TargetLowering::Promote:
-    case TargetLowering::Custom:
-      assert(0 && "Cannot promote/custom handle this yet!");
+      assert(0 && "Cannot promote handle this yet!");
+    case TargetLowering::Custom: {
+      Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1, Tmp2);
+      SDOperand Tmp = TLI.LowerOperation(Result, DAG);
+      if (Tmp.Val) {
+	Tmp = LegalizeOp(Tmp);  // Relegalize input.
+	AddLegalizedOperand(Op, Tmp);
+	return Tmp;
+      }
+      break;
+    }
     case TargetLowering::Expand:
       if (MVT::isInteger(Node->getValueType(0))) {
         MVT::ValueType VT = Node->getValueType(0);






More information about the llvm-commits mailing list