Put comma in correct place for call to StructType::get
[oota-llvm.git] / utils / TableGen / DAGISelEmitter.h
1 //===- DAGISelEmitter.h - Generate an instruction selector ------*- 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 emits a DAG instruction selector.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef DAGISEL_EMITTER_H
15 #define DAGISEL_EMITTER_H
16
17 #include "TableGenBackend.h"
18 #include "CodeGenDAGPatterns.h"
19 #include <set>
20
21 namespace llvm {
22
23 /// DAGISelEmitter - The top-level class which coordinates construction
24 /// and emission of the instruction selector.
25 ///
26 class DAGISelEmitter : public TableGenBackend {
27   RecordKeeper &Records;
28   CodeGenDAGPatterns CGP;
29 public:
30   DAGISelEmitter(RecordKeeper &R) : Records(R), CGP(R) {}
31
32   // run - Output the isel, returning true on failure.
33   void run(std::ostream &OS);
34   
35   
36 private:
37   void EmitNodeTransforms(std::ostream &OS);
38   void EmitPredicateFunctions(std::ostream &OS);
39   
40   void GenerateCodeForPattern(const PatternToMatch &Pattern,
41                   std::vector<std::pair<unsigned, std::string> > &GeneratedCode,
42                               std::set<std::string> &GeneratedDecl,
43                               std::vector<std::string> &TargetOpcodes,
44                               std::vector<std::string> &TargetVTs,
45                               bool &OutputIsVariadic,
46                               unsigned &NumInputRootOps);
47   void EmitPatterns(std::vector<std::pair<const PatternToMatch*, 
48                   std::vector<std::pair<unsigned, std::string> > > > &Patterns, 
49                     unsigned Indent, std::ostream &OS);
50   
51   void EmitInstructionSelector(std::ostream &OS);
52 };
53
54 } // End llvm namespace
55
56 #endif