blob: 2a6b063debd7159f58214783bb94e9a54f3d4e4b [file] [log] [blame]
Chris Lattnerf5bd1b72003-10-05 19:27:59 +00001//===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
John Criswelld3032032003-10-20 20:20:30 +00002//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by the LLVM research group and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
Chris Lattnerf5bd1b72003-10-05 19:27:59 +00009//
10// This tablegen backend is responsible for emitting a description of the target
11// instruction set for the code generator.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef INSTRINFO_EMITTER_H
16#define INSTRINFO_EMITTER_H
17
18#include "TableGenBackend.h"
Brian Gaeke960707c2003-11-11 22:41:34 +000019
20namespace llvm {
21
Chris Lattnerf5bd1b72003-10-05 19:27:59 +000022class StringInit;
23class IntInit;
24class ListInit;
25
26class InstrInfoEmitter : public TableGenBackend {
27 RecordKeeper &Records;
28public:
29 InstrInfoEmitter(RecordKeeper &R) : Records(R) {}
30
31 // run - Output the instruction set description, returning true on failure.
32 void run(std::ostream &OS);
33
34 // runEnums - Print out enum values for all of the instructions.
35 void runEnums(std::ostream &OS);
36private:
37 void printDefList(ListInit *LI, const std::string &Name,
38 std::ostream &OS) const;
39 void emitRecord(Record *R, unsigned Num, Record *InstrInfo, std::ostream &OS);
40 void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
41 std::ostream &OS);
42};
43
Brian Gaeke960707c2003-11-11 22:41:34 +000044} // End llvm namespace
45
Chris Lattnerf5bd1b72003-10-05 19:27:59 +000046#endif