llvm/mlir/lib/Dialect/SPIRV/IR/SPIRVAttributes.cpp

//===- SPIRVAttributes.cpp - SPIR-V attribute definitions -----------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/DialectImplementation.h"
#include "llvm/ADT/TypeSwitch.h"

usingnamespacemlir;
usingnamespacemlir::spirv;

//===----------------------------------------------------------------------===//
// TableGen'erated attribute utility functions
//===----------------------------------------------------------------------===//

namespace mlir {
namespace spirv {
#include "mlir/Dialect/SPIRV/IR/SPIRVAttrUtils.inc"
} // namespace spirv

//===----------------------------------------------------------------------===//
// Attribute storage classes
//===----------------------------------------------------------------------===//

namespace spirv {
namespace detail {

struct InterfaceVarABIAttributeStorage : public AttributeStorage {};

struct VerCapExtAttributeStorage : public AttributeStorage {};

struct TargetEnvAttributeStorage : public AttributeStorage {};
} // namespace detail
} // namespace spirv
} // namespace mlir

//===----------------------------------------------------------------------===//
// InterfaceVarABIAttr
//===----------------------------------------------------------------------===//

spirv::InterfaceVarABIAttr
spirv::InterfaceVarABIAttr::get(uint32_t descriptorSet, uint32_t binding,
                                std::optional<spirv::StorageClass> storageClass,
                                MLIRContext *context) {}

spirv::InterfaceVarABIAttr
spirv::InterfaceVarABIAttr::get(IntegerAttr descriptorSet, IntegerAttr binding,
                                IntegerAttr storageClass) {}

StringRef spirv::InterfaceVarABIAttr::getKindName() {}

uint32_t spirv::InterfaceVarABIAttr::getBinding() {}

uint32_t spirv::InterfaceVarABIAttr::getDescriptorSet() {}

std::optional<spirv::StorageClass>
spirv::InterfaceVarABIAttr::getStorageClass() {}

LogicalResult spirv::InterfaceVarABIAttr::verifyInvariants(
    function_ref<InFlightDiagnostic()> emitError, IntegerAttr descriptorSet,
    IntegerAttr binding, IntegerAttr storageClass) {}

//===----------------------------------------------------------------------===//
// VerCapExtAttr
//===----------------------------------------------------------------------===//

spirv::VerCapExtAttr spirv::VerCapExtAttr::get(
    spirv::Version version, ArrayRef<spirv::Capability> capabilities,
    ArrayRef<spirv::Extension> extensions, MLIRContext *context) {}

spirv::VerCapExtAttr spirv::VerCapExtAttr::get(IntegerAttr version,
                                               ArrayAttr capabilities,
                                               ArrayAttr extensions) {}

StringRef spirv::VerCapExtAttr::getKindName() {}

spirv::Version spirv::VerCapExtAttr::getVersion() {}

spirv::VerCapExtAttr::ext_iterator::ext_iterator(ArrayAttr::iterator it)
    :{}

spirv::VerCapExtAttr::ext_range spirv::VerCapExtAttr::getExtensions() {}

ArrayAttr spirv::VerCapExtAttr::getExtensionsAttr() {}

spirv::VerCapExtAttr::cap_iterator::cap_iterator(ArrayAttr::iterator it)
    :{}

spirv::VerCapExtAttr::cap_range spirv::VerCapExtAttr::getCapabilities() {}

ArrayAttr spirv::VerCapExtAttr::getCapabilitiesAttr() {}

LogicalResult spirv::VerCapExtAttr::verifyInvariants(
    function_ref<InFlightDiagnostic()> emitError, IntegerAttr version,
    ArrayAttr capabilities, ArrayAttr extensions) {}

//===----------------------------------------------------------------------===//
// TargetEnvAttr
//===----------------------------------------------------------------------===//

spirv::TargetEnvAttr spirv::TargetEnvAttr::get(
    spirv::VerCapExtAttr triple, ResourceLimitsAttr limits, ClientAPI clientAPI,
    Vendor vendorID, DeviceType deviceType, uint32_t deviceID) {}

StringRef spirv::TargetEnvAttr::getKindName() {}

spirv::VerCapExtAttr spirv::TargetEnvAttr::getTripleAttr() const {}

spirv::Version spirv::TargetEnvAttr::getVersion() const {}

spirv::VerCapExtAttr::ext_range spirv::TargetEnvAttr::getExtensions() {}

ArrayAttr spirv::TargetEnvAttr::getExtensionsAttr() {}

spirv::VerCapExtAttr::cap_range spirv::TargetEnvAttr::getCapabilities() {}

ArrayAttr spirv::TargetEnvAttr::getCapabilitiesAttr() {}

spirv::ClientAPI spirv::TargetEnvAttr::getClientAPI() const {}

spirv::Vendor spirv::TargetEnvAttr::getVendorID() const {}

spirv::DeviceType spirv::TargetEnvAttr::getDeviceType() const {}

uint32_t spirv::TargetEnvAttr::getDeviceID() const {}

spirv::ResourceLimitsAttr spirv::TargetEnvAttr::getResourceLimits() const {}

//===----------------------------------------------------------------------===//
// ODS Generated Attributes
//===----------------------------------------------------------------------===//

#define GET_ATTRDEF_CLASSES
#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.cpp.inc"

//===----------------------------------------------------------------------===//
// Attribute Parsing
//===----------------------------------------------------------------------===//

/// Parses a comma-separated list of keywords, invokes `processKeyword` on each
/// of the parsed keyword, and returns failure if any error occurs.
static ParseResult
parseKeywordList(DialectAsmParser &parser,
                 function_ref<LogicalResult(SMLoc, StringRef)> processKeyword) {}

/// Parses a spirv::InterfaceVarABIAttr.
static Attribute parseInterfaceVarABIAttr(DialectAsmParser &parser) {}

static Attribute parseVerCapExtAttr(DialectAsmParser &parser) {}

/// Parses a spirv::TargetEnvAttr.
static Attribute parseTargetEnvAttr(DialectAsmParser &parser) {}

Attribute SPIRVDialect::parseAttribute(DialectAsmParser &parser,
                                       Type type) const {}

//===----------------------------------------------------------------------===//
// Attribute Printing
//===----------------------------------------------------------------------===//

static void print(spirv::VerCapExtAttr triple, DialectAsmPrinter &printer) {}

static void print(spirv::TargetEnvAttr targetEnv, DialectAsmPrinter &printer) {}

static void print(spirv::InterfaceVarABIAttr interfaceVarABIAttr,
                  DialectAsmPrinter &printer) {}

void SPIRVDialect::printAttribute(Attribute attr,
                                  DialectAsmPrinter &printer) const {}

//===----------------------------------------------------------------------===//
// SPIR-V Dialect
//===----------------------------------------------------------------------===//

void spirv::SPIRVDialect::registerAttributes() {}