Add support for "cast" nodes, which are required when there is not enough information
[oota-llvm.git] / support / tools / TableGen / InstrInfoEmitter.h
1 //===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
2 //
3 // This tablegen backend is responsible for emitting a description of the target
4 // instruction set for the code generator.
5 //
6 //===----------------------------------------------------------------------===//
7
8 #ifndef INSTRINFO_EMITTER_H
9 #define INSTRINFO_EMITTER_H
10
11 #include "TableGenBackend.h"
12 class StringInit;
13 class IntInit;
14 class ListInit;
15
16 class InstrInfoEmitter : public TableGenBackend {
17   RecordKeeper &Records;
18 public:
19   InstrInfoEmitter(RecordKeeper &R) : Records(R) {}
20   
21   // run - Output the instruction set description, returning true on failure.
22   void run(std::ostream &OS);
23
24   // runEnums - Print out enum values for all of the instructions.
25   void runEnums(std::ostream &OS);
26 private:
27   void printDefList(ListInit *LI, const std::string &Name,
28                     std::ostream &OS) const;
29   void emitRecord(Record *R, unsigned Num, Record *InstrInfo, std::ostream &OS);
30   void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
31                         std::ostream &OS);
32 };
33
34 #endif