[llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Apr 6 13:37:04 PDT 2006



Changes in directory llvm/utils/TableGen:

DAGISelEmitter.cpp updated: 1.193 -> 1.194
---
Log message:

Infer element types for shuffle masks


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

 DAGISelEmitter.cpp |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+)


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.193 llvm/utils/TableGen/DAGISelEmitter.cpp:1.194
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.193	Thu Apr  6 15:19:52 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp	Thu Apr  6 15:36:51 2006
@@ -672,6 +672,26 @@
     // must have void types.
     if (NI.getNumResults() == 0)
       MadeChange |= UpdateNodeType(MVT::isVoid, TP);
+    
+    // If this is a vector_shuffle operation, apply types to the build_vector
+    // operation.  The types of the integers don't matter, but this ensures they
+    // won't get checked.
+    if (getOperator()->getName() == "vector_shuffle" &&
+        getChild(2)->getOperator()->getName() == "build_vector") {
+      TreePatternNode *BV = getChild(2);
+      const std::vector<MVT::ValueType> &LegalVTs
+        = ISE.getTargetInfo().getLegalValueTypes();
+      MVT::ValueType LegalIntVT = MVT::Other;
+      for (unsigned i = 0, e = LegalVTs.size(); i != e; ++i)
+        if (MVT::isInteger(LegalVTs[i]) && !MVT::isVector(LegalVTs[i])) {
+          LegalIntVT = LegalVTs[i];
+          break;
+        }
+      assert(LegalIntVT != MVT::Other && "No legal integer VT?");
+            
+      for (unsigned i = 0, e = BV->getNumChildren(); i != e; ++i)
+        MadeChange |= BV->getChild(i)->UpdateNodeType(LegalIntVT, TP);
+    }
     return MadeChange;  
   } else if (getOperator()->isSubClassOf("Instruction")) {
     const DAGInstruction &Inst = ISE.getInstruction(getOperator());






More information about the llvm-commits mailing list