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

Chris Lattner lattner at cs.uiuc.edu
Thu Mar 30 21:26:08 PST 2006



Changes in directory llvm/utils/TableGen:

DAGISelEmitter.cpp updated: 1.191 -> 1.192
---
Log message:

Allow bits init values to be used in patterns, turn them into ints.


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

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


Index: llvm/utils/TableGen/DAGISelEmitter.cpp
diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.191 llvm/utils/TableGen/DAGISelEmitter.cpp:1.192
--- llvm/utils/TableGen/DAGISelEmitter.cpp:1.191	Thu Mar 30 16:50:40 2006
+++ llvm/utils/TableGen/DAGISelEmitter.cpp	Thu Mar 30 23:25:56 2006
@@ -830,6 +830,15 @@
       New = new TreePatternNode(II);
       if (!Dag->getArgName(0).empty())
         error("Constant int argument should not have a name!");
+    } else if (BitsInit *BI = dynamic_cast<BitsInit*>(Arg)) {
+      // Turn this into an IntInit.
+      Init *II = BI->convertInitializerTo(new IntRecTy());
+      if (II == 0 || !dynamic_cast<IntInit*>(II))
+        error("Bits value must be constants!");
+      
+      New = new TreePatternNode(dynamic_cast<IntInit*>(II));
+      if (!Dag->getArgName(0).empty())
+        error("Constant int argument should not have a name!");
     } else {
       Arg->dump();
       error("Unknown leaf value for tree pattern!");
@@ -888,6 +897,16 @@
       if (!Dag->getArgName(i).empty())
         error("Constant int argument should not have a name!");
       Children.push_back(Node);
+    } else if (BitsInit *BI = dynamic_cast<BitsInit*>(Arg)) {
+      // Turn this into an IntInit.
+      Init *II = BI->convertInitializerTo(new IntRecTy());
+      if (II == 0 || !dynamic_cast<IntInit*>(II))
+        error("Bits value must be constants!");
+      
+      TreePatternNode *Node = new TreePatternNode(dynamic_cast<IntInit*>(II));
+      if (!Dag->getArgName(i).empty())
+        error("Constant int argument should not have a name!");
+      Children.push_back(Node);
     } else {
       std::cerr << '"';
       Arg->dump();






More information about the llvm-commits mailing list