blob: 6089f70e99f836e0eebee966db3fba2600372185 [file] [log] [blame]
Misha Brukman9fff7e12003-05-24 00:15:53 +00001//===- CodeEmitterGen.h - Code Emitter Generator ----------------*- C++ -*-===//
Misha Brukman3da94ae2005-04-22 00:00:37 +00002//
John Criswell01d45822003-10-20 20:20:30 +00003// 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.
Misha Brukman3da94ae2005-04-22 00:00:37 +00007//
John Criswell01d45822003-10-20 20:20:30 +00008//===----------------------------------------------------------------------===//
Misha Brukman9fff7e12003-05-24 00:15:53 +00009//
Chris Lattneraaa39392003-07-31 04:32:37 +000010// FIXME: document
Misha Brukman9fff7e12003-05-24 00:15:53 +000011//
12//===----------------------------------------------------------------------===//
13
14#ifndef CODEMITTERGEN_H
15#define CODEMITTERGEN_H
16
Chris Lattner0e5e49e2003-08-06 04:36:35 +000017#include "TableGenBackend.h"
Misha Brukman28eefa52004-10-14 05:53:01 +000018#include <map>
19#include <vector>
Misha Brukman9fff7e12003-05-24 00:15:53 +000020
Brian Gaeked0fde302003-11-11 22:41:34 +000021namespace llvm {
22
Misha Brukman28eefa52004-10-14 05:53:01 +000023class RecordVal;
24
Chris Lattner0e5e49e2003-08-06 04:36:35 +000025class CodeEmitterGen : public TableGenBackend {
Misha Brukman9fff7e12003-05-24 00:15:53 +000026 RecordKeeper &Records;
Misha Brukman9fff7e12003-05-24 00:15:53 +000027public:
28 CodeEmitterGen(RecordKeeper &R) : Records(R) {}
Misha Brukman3da94ae2005-04-22 00:00:37 +000029
Chris Lattner048c00d2003-08-01 04:38:18 +000030 // run - Output the code emitter
31 void run(std::ostream &o);
Chris Lattneraaa39392003-07-31 04:32:37 +000032private:
Misha Brukman9fff7e12003-05-24 00:15:53 +000033 void emitMachineOpEmitter(std::ostream &o, const std::string &Namespace);
34 void emitGetValueBit(std::ostream &o, const std::string &Namespace);
Misha Brukman28eefa52004-10-14 05:53:01 +000035 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);
Misha Brukman9fff7e12003-05-24 00:15:53 +000039};
40
Brian Gaeked0fde302003-11-11 22:41:34 +000041} // End llvm namespace
42
Misha Brukman9fff7e12003-05-24 00:15:53 +000043#endif