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

Chris Lattner lattner at cs.uiuc.edu
Wed Sep 28 11:28:40 PDT 2005



Changes in directory llvm/utils/TableGen:

DAGISelEmitter.cpp updated: 1.46 -> 1.47
DAGISelEmitter.h updated: 1.25 -> 1.26
---
Log message:

collect commutativity information


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

 DAGISelEmitter.cpp |   16 ++++++++++++++++
 DAGISelEmitter.h   |    8 ++++++++
 2 files changed, 24 insertions(+)


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.46 llvm/utils/TableGen/DAGISelEmitter.cpp:1.47
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.46	Wed Sep 28 12:57:56 2005
+++ llvm/utils/TableGen/DAGISelEmitter.cpp	Wed Sep 28 13:28:29 2005
@@ -137,6 +137,22 @@
   NumResults = TypeProfile->getValueAsInt("NumResults");
   NumOperands = TypeProfile->getValueAsInt("NumOperands");
   
+  // Parse the properties.
+  Properties = 0;
+  ListInit *LI = R->getValueAsListInit("Properties");
+  for (unsigned i = 0, e = LI->getSize(); i != e; ++i) {
+    DefInit *DI = dynamic_cast<DefInit*>(LI->getElement(i));
+    assert(DI && "Properties list must be list of defs!");
+    if (DI->getDef()->getName() == "SDNPCommutative") {
+      Properties |= 1 << SDNPCommutative;
+    } else {
+      std::cerr << "Unknown SD Node property '" << DI->getDef()->getName()
+                << "' on node '" << R->getName() << "'!\n";
+      exit(1);
+    }
+  }
+  
+  
   // Parse the type constraints.
   ListInit *Constraints = TypeProfile->getValueAsListInit("Constraints");
   for (unsigned i = 0, e = Constraints->getSize(); i != e; ++i) {


Index: llvm/utils/TableGen/DAGISelEmitter.h
diff -u llvm/utils/TableGen/DAGISelEmitter.h:1.25 llvm/utils/TableGen/DAGISelEmitter.h:1.26
--- llvm/utils/TableGen/DAGISelEmitter.h:1.25	Fri Sep 23 19:40:24 2005
+++ llvm/utils/TableGen/DAGISelEmitter.h	Wed Sep 28 13:28:29 2005
@@ -69,6 +69,7 @@
     Record *Def;
     std::string EnumName;
     std::string SDClassName;
+    unsigned Properties;
     unsigned NumResults;
     int NumOperands;
     std::vector<SDTypeConstraint> TypeConstraints;
@@ -84,6 +85,13 @@
     const std::vector<SDTypeConstraint> &getTypeConstraints() const {
       return TypeConstraints;
     }
+    
+    // SelectionDAG node properties.
+    enum SDNP { SDNPCommutative };
+
+    /// hasProperty - Return true if this node has the specified property.
+    ///
+    bool hasProperty(enum SDNP Prop) const { return Properties & (1 << Prop); }
 
     /// ApplyTypeConstraints - Given a node in a pattern, apply the type
     /// constraints for this node to the operands of the node.  This returns






More information about the llvm-commits mailing list