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

Chris Lattner lattner at cs.uiuc.edu
Fri Jan 7 14:38:03 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.9 -> 1.10
---
Log message:

Add support for truncating integer casts from long.


---
Diffs of the changes:  (+13 -1)

Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.9 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.10
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.9	Fri Jan  7 16:28:47 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Fri Jan  7 16:37:48 2005
@@ -556,8 +556,20 @@
       if (Tmp1 != Node->getOperand(0))
         Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1);
       break;
+    case Expand:
+      // In the expand case, we must be dealing with a truncate, because
+      // otherwise the result would be larger than the source.
+      assert(Node->getOpcode() == ISD::TRUNCATE &&
+             "Shouldn't need to expand other operators here!");
+      ExpandOp(Node->getOperand(0), Tmp1, Tmp2);
+
+      // Since the result is legal, we should just be able to truncate the low
+      // part of the source.
+      Result = DAG.getNode(ISD::TRUNCATE, Node->getValueType(0), Tmp1);
+      break;
+
     default:
-      assert(0 && "Do not know how to expand or promote this yet!");
+      assert(0 && "Do not know how to promote this yet!");
     }
     break;
   }






More information about the llvm-commits mailing list