#include "Basic/CodeGenIntrinsics.h"
#include "Common/CodeGenTarget.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include <algorithm>
#include <set>
#include <string>
#include <vector>
usingnamespacellvm;
#define DEBUG_TYPE …
static int64_t getAsInt(const Init *B) { … }
static int64_t getInt(const Record *R, StringRef Field) { … }
namespace {
struct GenericEnum { … };
struct GenericField { … };
struct SearchIndex { … };
struct GenericTable { … };
class SearchableTableEmitter { … };
}
int64_t SearchableTableEmitter::getNumericKey(const SearchIndex &Index,
const Record *Rec) { … }
bool SearchableTableEmitter::compareBy(const Record *LHS, const Record *RHS,
const SearchIndex &Index) { … }
void SearchableTableEmitter::emitIfdef(StringRef Guard, raw_ostream &OS) { … }
void SearchableTableEmitter::emitGenericEnum(const GenericEnum &Enum,
raw_ostream &OS) { … }
void SearchableTableEmitter::emitLookupFunction(const GenericTable &Table,
const SearchIndex &Index,
bool IsPrimary,
raw_ostream &OS) { … }
void SearchableTableEmitter::emitLookupDeclaration(const GenericTable &Table,
const SearchIndex &Index,
raw_ostream &OS) { … }
void SearchableTableEmitter::emitGenericTable(const GenericTable &Table,
raw_ostream &OS) { … }
bool SearchableTableEmitter::parseFieldType(GenericField &Field, Init *TypeOf) { … }
std::unique_ptr<SearchIndex> SearchableTableEmitter::parseSearchIndex(
GenericTable &Table, const RecordVal *KeyRecVal, StringRef Name,
ArrayRef<StringRef> Key, bool EarlyOut, bool ReturnRange) { … }
void SearchableTableEmitter::collectEnumEntries(
GenericEnum &Enum, StringRef NameField, StringRef ValueField,
ArrayRef<const Record *> Items) { … }
void SearchableTableEmitter::collectTableEntries(
GenericTable &Table, ArrayRef<const Record *> Items) { … }
void SearchableTableEmitter::run(raw_ostream &OS) { … }
static TableGen::Emitter::OptClass<SearchableTableEmitter>
X("gen-searchable-tables", "Generate generic binary-searchable table");