blob: 2dc34baaecdbb2fd79c9751bb4f7fe00a2130ae6 [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;
Daniel Dunbarfd96f342009-12-09 02:58:09 +000026struct Init;
Dan Gohmanf17a25c2007-07-18 16:29:46 +000027
28class CodeEmitterGen : public TableGenBackend {
29 RecordKeeper &Records;
30public:
31 CodeEmitterGen(RecordKeeper &R) : Records(R) {}
32
33 // run - Output the code emitter
Daniel Dunbard4287062009-07-03 00:10:29 +000034 void run(raw_ostream &o);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000035private:
Daniel Dunbard4287062009-07-03 00:10:29 +000036 void emitMachineOpEmitter(raw_ostream &o, const std::string &Namespace);
37 void emitGetValueBit(raw_ostream &o, const std::string &Namespace);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000038 void reverseBits(std::vector<Record*> &Insts);
Dan Gohmana45e4922009-12-05 00:05:43 +000039 int getVariableBit(const Init *VarVal, BitsInit *BI, int bit);
Dan Gohmanf17a25c2007-07-18 16:29:46 +000040};
41
42} // End llvm namespace
43
44#endif