Added LLVM copyright header.
[oota-llvm.git] / utils / TableGen / InstrInfoEmitter.h
1 //===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
2 // 
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 //===----------------------------------------------------------------------===//
9 //
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"
19 class StringInit;
20 class IntInit;
21 class ListInit;
22
23 class InstrInfoEmitter : public TableGenBackend {
24   RecordKeeper &Records;
25 public:
26   InstrInfoEmitter(RecordKeeper &R) : Records(R) {}
27   
28   // run - Output the instruction set description, returning true on failure.
29   void run(std::ostream &OS);
30
31   // runEnums - Print out enum values for all of the instructions.
32   void runEnums(std::ostream &OS);
33 private:
34   void printDefList(ListInit *LI, const std::string &Name,
35                     std::ostream &OS) const;
36   void emitRecord(Record *R, unsigned Num, Record *InstrInfo, std::ostream &OS);
37   void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
38                         std::ostream &OS);
39 };
40
41 #endif