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

Nate Begeman natebegeman at mac.com
Fri Apr 1 14:34:51 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.64 -> 1.65
SelectionDAG.cpp updated: 1.54 -> 1.55
---
Log message:

Add ISD::UNDEF node
Teach the SelectionDAG code how to expand and promote it
Have PPC32 LowerCallTo generate ISD::UNDEF for int arg regs used up by fp
  arguments, but not shadowing their value.  This allows us to do the right
  thing with both fixed and vararg floating point arguments.


---
Diffs of the changes:  (+25 -0)

 LegalizeDAG.cpp  |   24 ++++++++++++++++++++++++
 SelectionDAG.cpp |    1 +
 2 files changed, 25 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.64 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.65
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.64	Thu Mar 31 15:24:06 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Fri Apr  1 16:34:39 2005
@@ -219,6 +219,23 @@
     if (Tmp1 != Node->getOperand(0))
       Result = DAG.getImplicitDef(Tmp1, cast<RegSDNode>(Node)->getReg());
     break;
+  case ISD::UNDEF: {
+    MVT::ValueType VT = Op.getValueType();
+    switch (TLI.getOperationAction(ISD::UNDEF, VT)) {
+    case Expand:
+    case Promote:
+      if (MVT::isInteger(VT))
+        Result = DAG.getConstant(0, VT);
+      else if (MVT::isFloatingPoint(VT))
+        Result = DAG.getConstantFP(0, VT);
+      else
+        assert(0 && "Unknown value type!");
+      break;
+    case Legal:
+      break;
+    }
+    break;
+  }
   case ISD::Constant:
     // We know we don't need to expand constants here, constants only have one
     // value and we check that it is fine above.
@@ -1018,6 +1035,9 @@
     std::cerr << "NODE: "; Node->dump(); std::cerr << "\n";
     assert(0 && "Do not know how to promote this operator!");
     abort();
+  case ISD::UNDEF:
+    Result = DAG.getNode(ISD::UNDEF, NVT);
+    break;
   case ISD::Constant:
     Result = DAG.getNode(ISD::ZERO_EXTEND, NVT, Op);
     assert(isa<ConstantSDNode>(Result) && "Didn't constant fold zext?");
@@ -1574,6 +1594,10 @@
     std::cerr << "NODE: "; Node->dump(); std::cerr << "\n";
     assert(0 && "Do not know how to expand this operator!");
     abort();
+  case ISD::UNDEF:
+    Lo = DAG.getNode(ISD::UNDEF, NVT);
+    Hi = DAG.getNode(ISD::UNDEF, NVT);
+    break;
   case ISD::Constant: {
     uint64_t Cst = cast<ConstantSDNode>(Node)->getValue();
     Lo = DAG.getConstant(Cst, NVT);


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.54 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.55
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.54	Thu Mar 31 15:24:06 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp	Fri Apr  1 16:34:39 2005
@@ -1112,6 +1112,7 @@
   case ISD::CopyToReg:     return "CopyToReg";
   case ISD::CopyFromReg:   return "CopyFromReg";
   case ISD::ImplicitDef:   return "ImplicitDef";
+  case ISD::UNDEF:         return "undef";
 
   case ISD::ADD:    return "add";
   case ISD::SUB:    return "sub";






More information about the llvm-commits mailing list