Can't trust NodeDepth when checking for possibility of load folding creating
[oota-llvm.git] / utils / TableGen / CodeEmitterGen.h
1 //===- CodeEmitterGen.h - Code Emitter Generator ----------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
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.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // FIXME: document
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef CODEMITTERGEN_H
15 #define CODEMITTERGEN_H
16
17 #include "TableGenBackend.h"
18 #include <map>
19 #include <vector>
20
21 namespace llvm {
22
23 class RecordVal;
24
25 class CodeEmitterGen : public TableGenBackend {
26   RecordKeeper &Records;
27 public:
28   CodeEmitterGen(RecordKeeper &R) : Records(R) {}
29
30   // run - Output the code emitter
31   void run(std::ostream &o);
32 private:
33   void emitMachineOpEmitter(std::ostream &o, const std::string &Namespace);
34   void emitGetValueBit(std::ostream &o, const std::string &Namespace);
35   void emitInstrOpBits(std::ostream &o,
36                        const std::vector<RecordVal> &Vals,
37                        std::map<std::string, unsigned> &OpOrder,
38                        std::map<std::string, bool> &OpContinuous);
39 };
40
41 } // End llvm namespace
42
43 #endif