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

Chris Lattner lattner at cs.uiuc.edu
Thu Aug 7 14:22:01 PDT 2003


Changes in directory llvm/utils/TableGen:

InstrSelectorEmitter.cpp updated: 1.6 -> 1.7
InstrSelectorEmitter.h updated: 1.5 -> 1.6

---
Log message:

Read in expanders too


---
Diffs of the changes:

Index: llvm/utils/TableGen/InstrSelectorEmitter.cpp
diff -u llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.6 llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.7
--- llvm/utils/TableGen/InstrSelectorEmitter.cpp:1.6	Thu Aug  7 14:12:24 2003
+++ llvm/utils/TableGen/InstrSelectorEmitter.cpp	Thu Aug  7 14:21:10 2003
@@ -42,6 +42,7 @@
 ///
 void InstrSelectorEmitter::ProcessNodeTypes() {
   std::vector<Record*> Nodes = Records.getAllDerivedDefinitions("DagNode");
+  DEBUG(std::cerr << "Getting node types: ");
   for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
     Record *Node = Nodes[i];
     
@@ -70,8 +71,9 @@
 
     // Add the node type mapping now...
     NodeTypes[Node] = NodeType(RetTy, ArgTypes);
-    DEBUG(std::cerr << "Got node type '" << Node->getName() << "'\n");
+    DEBUG(std::cerr << Node->getName() << ", ");
   }
+  DEBUG(std::cerr << "DONE!\n");
 }
 
 static MVT::ValueType getIntrinsicType(Record *R) {
@@ -106,10 +108,10 @@
     AnyUnset = InferTypes(Tree, MadeChange);
   } while ((AnyUnset || MadeChange) && !(AnyUnset && !MadeChange));
 
-  if (PTy == Instruction) {
+  if (PTy == Instruction || PTy == Expander) {
     // Check to make sure there is not any unset types in the tree pattern...
     if (AnyUnset) {
-      std::cerr << "In instruction pattern: " << *Tree << "\n";
+      std::cerr << "In pattern: " << *Tree << "\n";
       error("Could not infer all types!");
     }
 
@@ -296,6 +298,20 @@
   }
 }
 
+/// ProcessExpanderPatterns - Read in all expander patterns...
+///
+void InstrSelectorEmitter::ProcessExpanderPatterns() {
+  std::vector<Record*> Expanders = Records.getAllDerivedDefinitions("Expander");
+  for (unsigned i = 0, e = Expanders.size(); i != e; ++i) {
+    Record *Expander = Expanders[i];
+    DagInit *DI = Expanders[i]->getValueAsDag("Pattern");
+
+    Pattern *P = new Pattern(Pattern::Expander, DI, Expanders[i], *this);
+
+    DEBUG(std::cerr << "Parsed " << *P << "\n");
+  }
+}
+
 
 void InstrSelectorEmitter::run(std::ostream &OS) {
   // Type-check all of the node types to ensure we "understand" them.
@@ -308,5 +324,5 @@
   ProcessInstructionPatterns();
 
   // Read all of the Expander patterns in...
-  
+  ProcessExpanderPatterns();
 }


Index: llvm/utils/TableGen/InstrSelectorEmitter.h
diff -u llvm/utils/TableGen/InstrSelectorEmitter.h:1.5 llvm/utils/TableGen/InstrSelectorEmitter.h:1.6
--- llvm/utils/TableGen/InstrSelectorEmitter.h:1.5	Thu Aug  7 14:12:24 2003
+++ llvm/utils/TableGen/InstrSelectorEmitter.h	Thu Aug  7 14:21:10 2003
@@ -199,6 +199,9 @@
   // ProcessInstructionPatterns - Read in all subclasses of Instruction, and
   // process those with a useful Pattern field.
   void ProcessInstructionPatterns();
+
+  // ProcessExpanderPatterns - Read in all of the expanded patterns.
+  void ProcessExpanderPatterns();
 };
 
 #endif





More information about the llvm-commits mailing list