blob: 400c0db16c699423b9c31aa97bf82bc89f2f7ded [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
Chris Lattnerbc017232003-08-06 04:32:07 +000011#include "TableGenBackend.h"
Chris Lattnera3ae6142003-08-03 21:57:51 +000012class StringInit;
13class IntInit;
Chris Lattnerbc017232003-08-06 04:32:07 +000014class ListInit;
Chris Lattner33ccf7e2003-08-03 17:24:10 +000015
Chris Lattnerbc017232003-08-06 04:32:07 +000016class InstrInfoEmitter : public TableGenBackend {
Chris Lattner33ccf7e2003-08-03 17:24:10 +000017 RecordKeeper &Records;
18public:
19 InstrInfoEmitter(RecordKeeper &R) : Records(R) {}
20
21 // run - Output the instruction set description, returning true on failure.
Chris Lattnera3ae6142003-08-03 21:57:51 +000022 void run(std::ostream &OS);
Chris Lattner33ccf7e2003-08-03 17:24:10 +000023
24 // runEnums - Print out enum values for all of the instructions.
Chris Lattnera3ae6142003-08-03 21:57:51 +000025 void runEnums(std::ostream &OS);
26private:
Chris Lattnerbc017232003-08-06 04:32:07 +000027 void printDefList(ListInit *LI, const std::string &Name,
28 std::ostream &OS) const;
Chris Lattnera3ae6142003-08-03 21:57:51 +000029 void emitRecord(Record *R, unsigned Num, Record *InstrInfo, std::ostream &OS);
30 void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
31 std::ostream &OS);
Chris Lattner33ccf7e2003-08-03 17:24:10 +000032};
33
34#endif