#include "Common/CodeGenInstruction.h"
#include "Common/CodeGenTarget.h"
#include "X86RecognizableInstr.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/X86FoldTablesUtils.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include <set>
usingnamespacellvm;
usingnamespaceX86Disassembler;
namespace {
struct ManualMapEntry { … };
const char *ExplicitAlign[] = …;
const char *ExplicitUnalign[] = …;
const ManualMapEntry ManualMapSet[] = …;
const std::set<StringRef> NoFoldSet = …;
static bool isExplicitAlign(const CodeGenInstruction *Inst) { … }
static bool isExplicitUnalign(const CodeGenInstruction *Inst) { … }
class X86FoldTablesEmitter { … };
static bool hasRSTRegClass(const CodeGenInstruction *Inst) { … }
static bool hasPtrTailcallRegClass(const CodeGenInstruction *Inst) { … }
static uint8_t byteFromBitsInit(const BitsInit *B) { … }
static bool mayFoldFromForm(uint8_t Form) { … }
static bool mayFoldToForm(uint8_t Form) { … }
static bool mayFoldFromLeftToRight(uint8_t LHS, uint8_t RHS) { … }
static bool isNOREXRegClass(const Record *Op) { … }
class IsMatch { … };
}
void X86FoldTablesEmitter::addEntryWithFlags(FoldTable &Table,
const CodeGenInstruction *RegInst,
const CodeGenInstruction *MemInst,
uint16_t S, unsigned FoldedIdx,
bool IsManual) { … }
void X86FoldTablesEmitter::addBroadcastEntry(
FoldTable &Table, const CodeGenInstruction *RegInst,
const CodeGenInstruction *MemInst) { … }
void X86FoldTablesEmitter::updateTables(const CodeGenInstruction *RegInst,
const CodeGenInstruction *MemInst,
uint16_t S, bool IsManual,
bool IsBroadcast) { … }
void X86FoldTablesEmitter::run(raw_ostream &OS) { … }
static TableGen::Emitter::OptClass<X86FoldTablesEmitter>
X("gen-x86-fold-tables", "Generate X86 fold tables");