#define INSTRINFO_EMITTER_H
#include "TableGenBackend.h"
+#include "CodeGenDAGPatterns.h"
#include <vector>
#include <map>
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);
- // runEnums - Print out enum values for all of the instructions.
- void runEnums(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