#include "mlir/TableGen/Attribute.h"
#include "mlir/TableGen/CodeGenHelpers.h"
#include "mlir/TableGen/Format.h"
#include "mlir/TableGen/GenInfo.h"
#include "mlir/TableGen/Operator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TableGen/Error.h"
#include "llvm/TableGen/Record.h"
#include "llvm/TableGen/TableGenBackend.h"
#include <list>
#include <optional>
ArrayRef;
formatv;
raw_ostream;
raw_string_ostream;
Record;
RecordKeeper;
SmallVector;
SMLoc;
StringMap;
StringRef;
Attribute;
EnumAttr;
EnumAttrCase;
NamedAttribute;
NamedTypeConstraint;
NamespaceEmitter;
Operator;
namespace {
class Availability { … };
}
Availability::Availability(const llvm::Record *def) : … { … }
StringRef Availability::getClass() const { … }
StringRef Availability::getInterfaceClassNamespace() const { … }
StringRef Availability::getInterfaceClassName() const { … }
StringRef Availability::getInterfaceDescription() const { … }
StringRef Availability::getQueryFnRetType() const { … }
StringRef Availability::getQueryFnName() const { … }
StringRef Availability::getMergeActionCode() const { … }
StringRef Availability::getMergeInitializer() const { … }
StringRef Availability::getMergeInstanceType() const { … }
StringRef Availability::getMergeInstancePreparation() const { … }
StringRef Availability::getMergeInstance() const { … }
std::vector<Availability> getAvailabilities(const Record &def) { … }
static void emitInterfaceDef(const Availability &availability,
raw_ostream &os) { … }
static bool emitInterfaceDefs(const RecordKeeper &recordKeeper,
raw_ostream &os) { … }
static void emitConceptDecl(const Availability &availability, raw_ostream &os) { … }
static void emitModelDecl(const Availability &availability, raw_ostream &os) { … }
static void emitInterfaceDecl(const Availability &availability,
raw_ostream &os) { … }
static bool emitInterfaceDecls(const RecordKeeper &recordKeeper,
raw_ostream &os) { … }
static mlir::GenRegistration
genInterfaceDecls("gen-avail-interface-decls",
"Generate availability interface declarations",
[](const RecordKeeper &records, raw_ostream &os) { … });
static mlir::GenRegistration
genInterfaceDefs("gen-avail-interface-defs",
"Generate op interface definitions",
[](const RecordKeeper &records, raw_ostream &os) { … });
static void emitAvailabilityQueryForIntEnum(const Record &enumDef,
raw_ostream &os) { … }
static void emitAvailabilityQueryForBitEnum(const Record &enumDef,
raw_ostream &os) { … }
static void emitEnumDecl(const Record &enumDef, raw_ostream &os) { … }
static bool emitEnumDecls(const RecordKeeper &recordKeeper, raw_ostream &os) { … }
static void emitEnumDef(const Record &enumDef, raw_ostream &os) { … }
static bool emitEnumDefs(const RecordKeeper &recordKeeper, raw_ostream &os) { … }
static mlir::GenRegistration
genEnumDecls("gen-spirv-enum-avail-decls",
"Generate SPIR-V enum availability declarations",
[](const RecordKeeper &records, raw_ostream &os) { … });
static mlir::GenRegistration
genEnumDefs("gen-spirv-enum-avail-defs",
"Generate SPIR-V enum availability definitions",
[](const RecordKeeper &records, raw_ostream &os) { … });
constexpr llvm::StringLiteral constantIdEnumAttrs[] = …;
static void emitAttributeSerialization(const Attribute &attr,
ArrayRef<SMLoc> loc, StringRef tabs,
StringRef opVar, StringRef operandList,
StringRef attrName, raw_ostream &os) { … }
static void emitArgumentSerialization(const Operator &op, ArrayRef<SMLoc> loc,
StringRef tabs, StringRef opVar,
StringRef operands, StringRef elidedAttrs,
raw_ostream &os) { … }
static void emitResultSerialization(const Operator &op, ArrayRef<SMLoc> loc,
StringRef tabs, StringRef opVar,
StringRef operands, StringRef resultID,
raw_ostream &os) { … }
static void emitDecorationSerialization(const Operator &op, StringRef tabs,
StringRef opVar, StringRef elidedAttrs,
StringRef resultID, raw_ostream &os) { … }
static void emitSerializationFunction(const Record *attrClass,
const Record *record, const Operator &op,
raw_ostream &os) { … }
static void initDispatchSerializationFn(StringRef opVar, raw_ostream &os) { … }
static void emitSerializationDispatch(const Operator &op, StringRef tabs,
StringRef opVar, raw_ostream &os) { … }
static void finalizeDispatchSerializationFn(StringRef opVar, raw_ostream &os) { … }
static void emitAttributeDeserialization(const Attribute &attr,
ArrayRef<SMLoc> loc, StringRef tabs,
StringRef attrList, StringRef attrName,
StringRef words, StringRef wordIndex,
raw_ostream &os) { … }
static void emitResultDeserialization(const Operator &op, ArrayRef<SMLoc> loc,
StringRef tabs, StringRef words,
StringRef wordIndex,
StringRef resultTypes, StringRef valueID,
raw_ostream &os) { … }
static void emitOperandDeserialization(const Operator &op, ArrayRef<SMLoc> loc,
StringRef tabs, StringRef words,
StringRef wordIndex, StringRef operands,
StringRef attributes, raw_ostream &os) { … }
static void emitDecorationDeserialization(const Operator &op, StringRef tabs,
StringRef valueID,
StringRef attributes,
raw_ostream &os) { … }
static void emitDeserializationFunction(const Record *attrClass,
const Record *record,
const Operator &op, raw_ostream &os) { … }
static void initDispatchDeserializationFn(StringRef opcode, StringRef words,
raw_ostream &os) { … }
static void emitDeserializationDispatch(const Operator &op, const Record *def,
StringRef tabs, StringRef words,
raw_ostream &os) { … }
static void finalizeDispatchDeserializationFn(StringRef opcode,
raw_ostream &os) { … }
static void initExtendedSetDeserializationDispatch(StringRef extensionSetName,
StringRef instructionID,
StringRef words,
raw_ostream &os) { … }
static void
emitExtendedSetDeserializationDispatch(const RecordKeeper &recordKeeper,
raw_ostream &os) { … }
static bool emitSerializationFns(const RecordKeeper &recordKeeper,
raw_ostream &os) { … }
static mlir::GenRegistration genSerialization(
"gen-spirv-serialization",
"Generate SPIR-V (de)serialization utilities and functions",
[](const RecordKeeper &records, raw_ostream &os) { … });
static void emitEnumGetAttrNameFnDecl(raw_ostream &os) { … }
static void emitEnumGetAttrNameFnDefn(const EnumAttr &enumAttr,
raw_ostream &os) { … }
static bool emitAttrUtils(const RecordKeeper &recordKeeper, raw_ostream &os) { … }
static mlir::GenRegistration
genOpUtils("gen-spirv-attr-utils",
"Generate SPIR-V attribute utility definitions",
[](const RecordKeeper &records, raw_ostream &os) { … });
static void emitAvailabilityImpl(const Operator &srcOp, raw_ostream &os) { … }
static bool emitAvailabilityImpl(const RecordKeeper &recordKeeper,
raw_ostream &os) { … }
static mlir::GenRegistration
genOpAvailabilityImpl("gen-spirv-avail-impls",
"Generate SPIR-V operation utility definitions",
[](const RecordKeeper &records, raw_ostream &os) { … });
static bool emitCapabilityImplication(const RecordKeeper &recordKeeper,
raw_ostream &os) { … }
static mlir::GenRegistration
genCapabilityImplication("gen-spirv-capability-implication",
"Generate utility function to return implied "
"capabilities for a given capability",
[](const RecordKeeper &records, raw_ostream &os) { … });