blob: cb272bd56d25e009166adc2e59be1dfa3292b7ba [file] [log] [blame]
Chris Lattnerf5bd1b72003-10-05 19:27:59 +00001//===- CodeEmitterGen.h - Code Emitter Generator ----------------*- C++ -*-===//
Misha Brukman650ba8e2005-04-22 00:00:37 +00002//
John Criswelld3032032003-10-20 20:20:30 +00003// The LLVM Compiler Infrastructure
4//
Chris Lattner8adcd9f2007-12-29 20:37:13 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Misha Brukman650ba8e2005-04-22 00:00:37 +00007//
John Criswelld3032032003-10-20 20:20:30 +00008//===----------------------------------------------------------------------===//
Chris Lattnerf5bd1b72003-10-05 19:27:59 +00009//
10// FIXME: document
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CODEMITTERGEN_H
15#define CODEMITTERGEN_H
16
17#include "TableGenBackend.h"
Misha Brukman8393c152004-10-14 05:53:01 +000018#include <map>
19#include <vector>
Jim Laskeya44f6262006-07-13 21:02:53 +000020#include <string>
Chris Lattnerf5bd1b72003-10-05 19:27:59 +000021
Brian Gaeke960707c2003-11-11 22:41:34 +000022namespace llvm {
23
Misha Brukman8393c152004-10-14 05:53:01 +000024class RecordVal;
Jim Laskeya44f6262006-07-13 21:02:53 +000025class BitsInit;
Misha Brukman8393c152004-10-14 05:53:01 +000026
Chris Lattnerf5bd1b72003-10-05 19:27:59 +000027class CodeEmitterGen : public TableGenBackend {
28 RecordKeeper &Records;
29public:
30 CodeEmitterGen(RecordKeeper &R) : Records(R) {}
Misha Brukman650ba8e2005-04-22 00:00:37 +000031
Chris Lattnerf5bd1b72003-10-05 19:27:59 +000032 // run - Output the code emitter
33 void run(std::ostream &o);
34private:
35 void emitMachineOpEmitter(std::ostream &o, const std::string &Namespace);
36 void emitGetValueBit(std::ostream &o, const std::string &Namespace);
Jim Laskeya44f6262006-07-13 21:02:53 +000037 void reverseBits(std::vector<Record*> &Insts);
38 int getVariableBit(const std::string &VarName, BitsInit *BI, int bit);
Chris Lattnerf5bd1b72003-10-05 19:27:59 +000039};
40
Brian Gaeke960707c2003-11-11 22:41:34 +000041} // End llvm namespace
42
Chris Lattnerf5bd1b72003-10-05 19:27:59 +000043#endif