blob: e0a7071ed6dcf5cf47339f3f5df5d84293b5110c [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>
Jim Laskeyf1b05bf2006-07-13 21:02:53 +000020#include <string>
Misha Brukman9fff7e12003-05-24 00:15:53 +000021
Brian Gaeked0fde302003-11-11 22:41:34 +000022namespace llvm {
23
Misha Brukman28eefa52004-10-14 05:53:01 +000024class RecordVal;
Jim Laskeyf1b05bf2006-07-13 21:02:53 +000025class BitsInit;
Misha Brukman28eefa52004-10-14 05:53:01 +000026
Chris Lattner0e5e49e2003-08-06 04:36:35 +000027class CodeEmitterGen : public TableGenBackend {
Misha Brukman9fff7e12003-05-24 00:15:53 +000028 RecordKeeper &Records;
Misha Brukman9fff7e12003-05-24 00:15:53 +000029public:
30 CodeEmitterGen(RecordKeeper &R) : Records(R) {}
Misha Brukman3da94ae2005-04-22 00:00:37 +000031
Chris Lattner048c00d2003-08-01 04:38:18 +000032 // run - Output the code emitter
33 void run(std::ostream &o);
Chris Lattneraaa39392003-07-31 04:32:37 +000034private:
Misha Brukman9fff7e12003-05-24 00:15:53 +000035 void emitMachineOpEmitter(std::ostream &o, const std::string &Namespace);
36 void emitGetValueBit(std::ostream &o, const std::string &Namespace);
Jim Laskeyf1b05bf2006-07-13 21:02:53 +000037 void reverseBits(std::vector<Record*> &Insts);
38 int getVariableBit(const std::string &VarName, BitsInit *BI, int bit);
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