Converted a1.ll to unittests.
[oota-llvm.git] / utils / TableGen / InstrInfoEmitter.h
index fe40b5803d7b7daf6aa5720ebd5f19cdd4fc7cda..870ea0c58780963223570e35898f984e418c3cfa 100644 (file)
@@ -16,6 +16,7 @@
 #define INSTRINFO_EMITTER_H
 
 #include "TableGenBackend.h"
+#include "CodeGenDAGPatterns.h"
 #include <vector>
 #include <map>
 
@@ -28,28 +29,38 @@ class CodeGenInstruction;
 
 class InstrInfoEmitter : public TableGenBackend {
   RecordKeeper &Records;
-  bool IsItineraries;
+  CodeGenDAGPatterns CDP;
   std::map<std::string, unsigned> ItinClassMap;
   
 public:
-  InstrInfoEmitter(RecordKeeper &R) : Records(R), IsItineraries(false) {}
+  InstrInfoEmitter(RecordKeeper &R) : Records(R), CDP(R) { }
 
   // run - Output the instruction set description, returning true on failure.
   void run(std::ostream &OS);
 
 private:
-  void printDefList(const std::vector<Record*> &Uses, unsigned Num,
-                    std::ostream &OS) const;
+  typedef std::map<std::vector<std::string>, unsigned> OperandInfoMapTy;
+  
   void emitRecord(const CodeGenInstruction &Inst, unsigned Num,
                   Record *InstrInfo, 
                   std::map<std::vector<Record*>, unsigned> &EL,
-                  std::map<std::vector<std::string>, unsigned> &OpInfo,
+                  std::map<Record*, unsigned> &BM,
+                  const OperandInfoMapTy &OpInfo,
                   std::ostream &OS);
-  void GatherItinClasses();
-  unsigned ItinClassNumber(std::string ItinName);
   void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
                         std::ostream &OS);
+
+  // Itinerary information.
+  void GatherItinClasses();
+  unsigned getItinClassNumber(const Record *InstRec);
+  
+  // Operand information.
+  void EmitOperandInfo(std::ostream &OS, OperandInfoMapTy &OperandInfoIDs);
   std::vector<std::string> GetOperandInfo(const CodeGenInstruction &Inst);
+
+  void DetectRegisterClassBarriers(std::vector<Record*> &Defs,
+                                   const std::vector<CodeGenRegisterClass> &RCs,
+                                   std::vector<Record*> &Barriers);
 };
 
 } // End llvm namespace