blob: f0b3229c0411a4b8da8791a7202d426e63f04922 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001//===- CodeEmitterGen.h - Code Emitter Generator ----------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerfd6c2f02007-12-29 20:37:13 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007//
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#include <string>
21
22namespace llvm {
23
24class RecordVal;
25class BitsInit;
26
27class CodeEmitterGen : public TableGenBackend {
28 RecordKeeper &Records;
29public:
30 CodeEmitterGen(RecordKeeper &R) : Records(R) {}
31
32 // run - Output the code emitter
Daniel Dunbard4287062009-07-03 00:10:29 +000033 void run(raw_ostream &o);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000034private:
Daniel Dunbard4287062009-07-03 00:10:29 +000035 void emitMachineOpEmitter(raw_ostream &o, const std::string &Namespace);
36 void emitGetValueBit(raw_ostream &o, const std::string &Namespace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000037 void reverseBits(std::vector<Record*> &Insts);
Dan Gohman8f4f9942009-12-15 20:21:44 +000038 int getVariableBit(const std::string &VarName, BitsInit *BI, int bit);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000039};
40
41} // End llvm namespace
42
43#endif