#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,
const BitsInit *BI, int bit) { … }
bool CodeEmitterGen::addCodeToMergeInOperand(const Record *R,
const BitsInit *BI,
const std::string &VarName,
std::string &Case,
std::string &BitOffsetCase,
const CodeGenTarget &Target) { … }
std::pair<std::string, std::string>
CodeEmitterGen::getInstructionCases(const Record *R,
const CodeGenTarget &Target) { … }
void CodeEmitterGen::addInstructionCasesForEncoding(
const Record *R, const Record *EncodingDef, const 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,
const 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");