1 //===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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"
27 class CodeGenInstruction;
29 class InstrInfoEmitter : public TableGenBackend {
30 RecordKeeper &Records;
32 std::map<std::string, unsigned> ItinClassMap;
35 InstrInfoEmitter(RecordKeeper &R) : Records(R), IsItineraries(false) {}
37 // run - Output the instruction set description, returning true on failure.
38 void run(std::ostream &OS);
41 void printDefList(const std::vector<Record*> &Uses, unsigned Num,
42 std::ostream &OS) const;
43 void emitRecord(const CodeGenInstruction &Inst, unsigned Num,
45 std::map<std::vector<Record*>, unsigned> &EL,
46 std::map<std::vector<std::string>, unsigned> &OpInfo,
48 void GatherItinClasses();
49 unsigned ItinClassNumber(std::string ItinName);
50 void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
52 std::vector<std::string> GetOperandInfo(const CodeGenInstruction &Inst);
55 } // End llvm namespace