1 //===- InstrInfoEmitter.h - Generate a Instruction Set Desc. ----*- C++ -*-===//
3 // This tablegen backend is responsible for emitting a description of the target
4 // instruction set for the code generator.
6 //===----------------------------------------------------------------------===//
8 #ifndef INSTRSELECTOR_EMITTER_H
9 #define INSTRSELECTOR_EMITTER_H
11 #include "TableGenBackend.h"
17 // Both argument and return types...
18 Val, // A non-void type
19 Arg0, // Value matches the type of Arg0
22 Void, // Tree node always returns void
25 Ptr, // Tree node is the target argument type
28 ArgResultTypes ResultType;
29 std::vector<ArgResultTypes> ArgTypes;
31 NodeType(ArgResultTypes RT, std::vector<ArgResultTypes> &AT) : ResultType(RT){
35 NodeType() : ResultType(Val) {}
36 NodeType(const NodeType &N) : ResultType(N.ResultType), ArgTypes(N.ArgTypes){}
38 static ArgResultTypes Translate(Record *R);
42 class InstrSelectorEmitter : public TableGenBackend {
43 RecordKeeper &Records;
45 std::map<Record*, NodeType> NodeTypes;
47 InstrSelectorEmitter(RecordKeeper &R) : Records(R) {}
49 // run - Output the instruction set description, returning true on failure.
50 void run(std::ostream &OS);
53 // ProcessNodeTypes - Process all of the node types in the current
54 // RecordKeeper, turning them into the more accessible NodeTypes data
56 void ProcessNodeTypes();