Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===- DAGISelEmitter.h - Generate an instruction selector ------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | fd6c2f0 | 2007-12-29 20:37:13 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 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 | |
Chris Lattner | 4ca8ff0 | 2008-01-05 22:25:12 +0000 | [diff] [blame^] | 17 | #include "CodeGenDAGPatterns.h" |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 18 | #include <set> |
| 19 | |
| 20 | namespace llvm { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 21 | |
| 22 | /// DAGISelEmitter - The top-level class which coordinates construction |
| 23 | /// and emission of the instruction selector. |
| 24 | /// |
| 25 | class DAGISelEmitter : public TableGenBackend { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 26 | RecordKeeper &Records; |
Chris Lattner | 4ca8ff0 | 2008-01-05 22:25:12 +0000 | [diff] [blame^] | 27 | CodegenDAGPatterns *CGP; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 28 | public: |
| 29 | DAGISelEmitter(RecordKeeper &R) : Records(R) {} |
| 30 | |
| 31 | // run - Output the isel, returning true on failure. |
| 32 | void run(std::ostream &OS); |
| 33 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 34 | |
| 35 | private: |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 36 | void GenerateCodeForPattern(PatternToMatch &Pattern, |
| 37 | std::vector<std::pair<unsigned, std::string> > &GeneratedCode, |
| 38 | std::set<std::string> &GeneratedDecl, |
| 39 | std::vector<std::string> &TargetOpcodes, |
| 40 | std::vector<std::string> &TargetVTs); |
| 41 | void EmitPatterns(std::vector<std::pair<PatternToMatch*, |
| 42 | std::vector<std::pair<unsigned, std::string> > > > &Patterns, |
| 43 | unsigned Indent, std::ostream &OS); |
| 44 | void EmitInstructionSelector(std::ostream &OS); |
| 45 | }; |
| 46 | |
| 47 | } // End llvm namespace |
| 48 | |
| 49 | #endif |