Silence -Wunused-variable in release builds.
[llvm/stm8.git] / utils / TableGen / InstrInfoEmitter.h
blob165ce423ab60a61f98707a133601411390f77a88
1 //===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // 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.
13 //===----------------------------------------------------------------------===//
15 #ifndef INSTRINFO_EMITTER_H
16 #define INSTRINFO_EMITTER_H
18 #include "TableGenBackend.h"
19 #include "CodeGenDAGPatterns.h"
20 #include <vector>
21 #include <map>
23 namespace llvm {
25 class StringInit;
26 class IntInit;
27 class ListInit;
28 class CodeGenInstruction;
30 class InstrInfoEmitter : public TableGenBackend {
31 RecordKeeper &Records;
32 CodeGenDAGPatterns CDP;
33 std::map<std::string, unsigned> ItinClassMap;
35 public:
36 InstrInfoEmitter(RecordKeeper &R) : Records(R), CDP(R) { }
38 // run - Output the instruction set description, returning true on failure.
39 void run(raw_ostream &OS);
41 private:
42 void emitEnums(raw_ostream &OS);
44 typedef std::map<std::vector<std::string>, unsigned> OperandInfoMapTy;
45 void emitRecord(const CodeGenInstruction &Inst, unsigned Num,
46 Record *InstrInfo,
47 std::map<std::vector<Record*>, unsigned> &EL,
48 const OperandInfoMapTy &OpInfo,
49 raw_ostream &OS);
51 // Itinerary information.
52 void GatherItinClasses();
53 unsigned getItinClassNumber(const Record *InstRec);
55 // Operand information.
56 void EmitOperandInfo(raw_ostream &OS, OperandInfoMapTy &OperandInfoIDs);
57 std::vector<std::string> GetOperandInfo(const CodeGenInstruction &Inst);
60 } // End llvm namespace
62 #endif