blob: 400c0db16c699423b9c31aa97bf82bc89f2f7ded [file] [log] [blame]
Chris Lattnerf5bd1b72003-10-05 19:27:59 +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 "TableGenBackend.h"
12class StringInit;
13class IntInit;
14class ListInit;
15
16class InstrInfoEmitter : public TableGenBackend {
17 RecordKeeper &Records;
18public:
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);
26private:
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