#include "Common/CodeGenHwModes.h"
#include "Common/CodeGenInstruction.h"
#include "Common/CodeGenTarget.h"
#include "Common/InfoByHwMode.h"
#include "Common/VarLenCodeEmitterGen.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include <cstdint>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <vector>
usingnamespacellvm;
namespace {
class CodeEmitterGen { … };
int CodeEmitterGen::getVariableBit(const std::string &VarName, BitsInit *BI,
int bit) { … }
bool CodeEmitterGen::addCodeToMergeInOperand(Record *R, BitsInit *BI,
const std::string &VarName,
std::string &Case,
std::string &BitOffsetCase,
CodeGenTarget &Target) { … }
std::pair<std::string, std::string>
CodeEmitterGen::getInstructionCases(Record *R, CodeGenTarget &Target) { … }
void CodeEmitterGen::addInstructionCasesForEncoding(
Record *R, const Record *EncodingDef, CodeGenTarget &Target,
std::string &Case, std::string &BitOffsetCase) { … }
static void emitInstBits(raw_ostream &OS, const APInt &Bits) { … }
void CodeEmitterGen::emitInstructionBaseValues(
raw_ostream &o, ArrayRef<const CodeGenInstruction *> NumberedInstructions,
CodeGenTarget &Target, unsigned HwMode) { … }
void CodeEmitterGen::emitCaseMap(
raw_ostream &o,
const std::map<std::string, std::vector<std::string>> &CaseMap) { … }
void CodeEmitterGen::run(raw_ostream &o) { … }
}
static TableGen::Emitter::OptClass<CodeEmitterGen>
X("gen-emitter", "Generate machine code emitter");