blob: 0415f043ce48bacdf3805e798e2006b56bebfbfc [file] [log] [blame]
Chris Lattner33ccf7e2003-08-03 17:24:10 +00001//===- 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 <iosfwd>
12class RecordKeeper;
Chris Lattnera3ae6142003-08-03 21:57:51 +000013class Record;
14class StringInit;
15class IntInit;
Chris Lattner33ccf7e2003-08-03 17:24:10 +000016
17class InstrInfoEmitter {
18 RecordKeeper &Records;
19public:
20 InstrInfoEmitter(RecordKeeper &R) : Records(R) {}
21
22 // run - Output the instruction set description, returning true on failure.
Chris Lattnera3ae6142003-08-03 21:57:51 +000023 void run(std::ostream &OS);
Chris Lattner33ccf7e2003-08-03 17:24:10 +000024
25 // runEnums - Print out enum values for all of the instructions.
Chris Lattnera3ae6142003-08-03 21:57:51 +000026 void runEnums(std::ostream &OS);
27private:
28 void emitRecord(Record *R, unsigned Num, Record *InstrInfo, std::ostream &OS);
29 void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
30 std::ostream &OS);
Chris Lattner33ccf7e2003-08-03 17:24:10 +000031};
32
33#endif