1 //===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
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 struct 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);
40 // runEnums - Print out enum values for all of the instructions.
41 void runEnums(std::ostream &OS);
43 void printDefList(const std::vector<Record*> &Uses, unsigned Num,
44 std::ostream &OS) const;
45 void emitRecord(const CodeGenInstruction &Inst, unsigned Num,
47 std::map<std::vector<Record*>, unsigned> &EL,
48 std::map<std::vector<Record*>, unsigned> &OpInfo,
50 void GatherItinClasses();
51 unsigned ItinClassNumber(std::string ItinName);
52 void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift,
56 } // End llvm namespace