Improve LSR's dead-phi detection to handle use-def cycles
[oota-llvm.git] / utils / TableGen / InstrInfoEmitter.h
index fe40b5803d7b7daf6aa5720ebd5f19cdd4fc7cda..2dd3a0f44fc9fc885c5ba27f646ea2a1602219fd 100644 (file)
@@ -16,6 +16,7 @@
 #define INSTRINFO_EMITTER_H
 
 #include "TableGenBackend.h"
+#include "CodeGenDAGPatterns.h"
 #include <vector>
 #include <map>
 
@@ -28,27 +29,32 @@ 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,
+                  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);
 };