2003-10-05 21:27:59 +02:00
|
|
|
//===- CodeEmitterGen.h - Code Emitter Generator ----------------*- C++ -*-===//
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2003-10-20 22:20:30 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:37:13 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 02:00:37 +02:00
|
|
|
//
|
2003-10-20 22:20:30 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2003-10-05 21:27:59 +02:00
|
|
|
//
|
|
|
|
// FIXME: document
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef CODEMITTERGEN_H
|
|
|
|
#define CODEMITTERGEN_H
|
|
|
|
|
2011-10-01 18:41:13 +02:00
|
|
|
#include "llvm/TableGen/TableGenBackend.h"
|
2004-10-14 07:53:01 +02:00
|
|
|
#include <vector>
|
2006-07-13 23:02:53 +02:00
|
|
|
#include <string>
|
2003-10-05 21:27:59 +02:00
|
|
|
|
2003-11-11 23:41:34 +01:00
|
|
|
namespace llvm {
|
|
|
|
|
2004-10-14 07:53:01 +02:00
|
|
|
class RecordVal;
|
2006-07-13 23:02:53 +02:00
|
|
|
class BitsInit;
|
2010-11-15 07:59:17 +01:00
|
|
|
class CodeGenTarget;
|
2004-10-14 07:53:01 +02:00
|
|
|
|
2003-10-05 21:27:59 +02:00
|
|
|
class CodeEmitterGen : public TableGenBackend {
|
|
|
|
RecordKeeper &Records;
|
|
|
|
public:
|
|
|
|
CodeEmitterGen(RecordKeeper &R) : Records(R) {}
|
2005-04-22 02:00:37 +02:00
|
|
|
|
2003-10-05 21:27:59 +02:00
|
|
|
// run - Output the code emitter
|
2009-07-03 02:10:29 +02:00
|
|
|
void run(raw_ostream &o);
|
2003-10-05 21:27:59 +02:00
|
|
|
private:
|
2009-07-03 02:10:29 +02:00
|
|
|
void emitMachineOpEmitter(raw_ostream &o, const std::string &Namespace);
|
|
|
|
void emitGetValueBit(raw_ostream &o, const std::string &Namespace);
|
2006-07-13 23:02:53 +02:00
|
|
|
void reverseBits(std::vector<Record*> &Insts);
|
2011-07-30 00:43:06 +02:00
|
|
|
int getVariableBit(const std::string &VarName, BitsInit *BI, int bit);
|
2010-11-15 07:59:17 +01:00
|
|
|
std::string getInstructionCase(Record *R, CodeGenTarget &Target);
|
|
|
|
void
|
2011-07-30 00:43:06 +02:00
|
|
|
AddCodeToMergeInOperand(Record *R, BitsInit *BI, const std::string &VarName,
|
2011-07-12 01:06:52 +02:00
|
|
|
unsigned &NumberedOp,
|
2010-11-15 07:59:17 +01:00
|
|
|
std::string &Case, CodeGenTarget &Target);
|
|
|
|
|
2003-10-05 21:27:59 +02:00
|
|
|
};
|
|
|
|
|
2003-11-11 23:41:34 +01:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2003-10-05 21:27:59 +02:00
|
|
|
#endif
|