llvm/mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp

//===- Deserializer.cpp - MLIR SPIR-V Deserializer ------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// This file defines the SPIR-V binary to MLIR SPIR-V module deserializer.
//
//===----------------------------------------------------------------------===//

#include "Deserializer.h"

#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVOps.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVTypes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Location.h"
#include "mlir/Target/SPIRV/SPIRVBinaryUtils.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/bit.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/SaveAndRestore.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>

usingnamespacemlir;

#define DEBUG_TYPE

//===----------------------------------------------------------------------===//
// Utility Functions
//===----------------------------------------------------------------------===//

/// Returns true if the given `block` is a function entry block.
static inline bool isFnEntryBlock(Block *block) {}

//===----------------------------------------------------------------------===//
// Deserializer Method Definitions
//===----------------------------------------------------------------------===//

spirv::Deserializer::Deserializer(ArrayRef<uint32_t> binary,
                                  MLIRContext *context)
    :{}

LogicalResult spirv::Deserializer::deserialize() {}

OwningOpRef<spirv::ModuleOp> spirv::Deserializer::collect() {}

//===----------------------------------------------------------------------===//
// Module structure
//===----------------------------------------------------------------------===//

OwningOpRef<spirv::ModuleOp> spirv::Deserializer::createModuleOp() {}

LogicalResult spirv::Deserializer::processHeader() {}

LogicalResult
spirv::Deserializer::processCapability(ArrayRef<uint32_t> operands) {}

LogicalResult spirv::Deserializer::processExtension(ArrayRef<uint32_t> words) {}

LogicalResult
spirv::Deserializer::processExtInstImport(ArrayRef<uint32_t> words) {}

void spirv::Deserializer::attachVCETriple() {}

LogicalResult
spirv::Deserializer::processMemoryModel(ArrayRef<uint32_t> operands) {}

LogicalResult spirv::Deserializer::processDecoration(ArrayRef<uint32_t> words) {}

LogicalResult
spirv::Deserializer::processMemberDecoration(ArrayRef<uint32_t> words) {}

LogicalResult spirv::Deserializer::processMemberName(ArrayRef<uint32_t> words) {}

LogicalResult spirv::Deserializer::setFunctionArgAttrs(
    uint32_t argID, SmallVectorImpl<Attribute> &argAttrs, size_t argIndex) {}

LogicalResult
spirv::Deserializer::processFunction(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processFunctionEnd(ArrayRef<uint32_t> operands) {}

std::optional<std::pair<Attribute, Type>>
spirv::Deserializer::getConstant(uint32_t id) {}

std::optional<spirv::SpecConstOperationMaterializationInfo>
spirv::Deserializer::getSpecConstantOperation(uint32_t id) {}

std::string spirv::Deserializer::getFunctionSymbol(uint32_t id) {}

std::string spirv::Deserializer::getSpecConstantSymbol(uint32_t id) {}

spirv::SpecConstantOp
spirv::Deserializer::createSpecConstant(Location loc, uint32_t resultID,
                                        TypedAttr defaultValue) {}

LogicalResult
spirv::Deserializer::processGlobalVariable(ArrayRef<uint32_t> operands) {}

IntegerAttr spirv::Deserializer::getConstantInt(uint32_t id) {}

LogicalResult spirv::Deserializer::processName(ArrayRef<uint32_t> operands) {}

//===----------------------------------------------------------------------===//
// Type
//===----------------------------------------------------------------------===//

LogicalResult spirv::Deserializer::processType(spirv::Opcode opcode,
                                               ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processOpTypePointer(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processArrayType(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processFunctionType(ArrayRef<uint32_t> operands) {}

LogicalResult spirv::Deserializer::processCooperativeMatrixTypeKHR(
    ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processRuntimeArrayType(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processStructType(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processMatrixType(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processTypeForwardPointer(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processImageType(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processSampledImageType(ArrayRef<uint32_t> operands) {}

//===----------------------------------------------------------------------===//
// Constant
//===----------------------------------------------------------------------===//

LogicalResult spirv::Deserializer::processConstant(ArrayRef<uint32_t> operands,
                                                   bool isSpec) {}

LogicalResult spirv::Deserializer::processConstantBool(
    bool isTrue, ArrayRef<uint32_t> operands, bool isSpec) {}

LogicalResult
spirv::Deserializer::processConstantComposite(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processSpecConstantComposite(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processSpecConstantOperation(ArrayRef<uint32_t> operands) {}

Value spirv::Deserializer::materializeSpecConstantOperation(
    uint32_t resultID, spirv::Opcode enclosedOpcode, uint32_t resultTypeID,
    ArrayRef<uint32_t> enclosedOpOperands) {}

LogicalResult
spirv::Deserializer::processConstantNull(ArrayRef<uint32_t> operands) {}

//===----------------------------------------------------------------------===//
// Control flow
//===----------------------------------------------------------------------===//

Block *spirv::Deserializer::getOrCreateBlock(uint32_t id) {}

LogicalResult spirv::Deserializer::processBranch(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processBranchConditional(ArrayRef<uint32_t> operands) {}

LogicalResult spirv::Deserializer::processLabel(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processSelectionMerge(ArrayRef<uint32_t> operands) {}

LogicalResult
spirv::Deserializer::processLoopMerge(ArrayRef<uint32_t> operands) {}

LogicalResult spirv::Deserializer::processPhi(ArrayRef<uint32_t> operands) {}

namespace {
/// A class for putting all blocks in a structured selection/loop in a
/// spirv.mlir.selection/spirv.mlir.loop op.
class ControlFlowStructurizer {};
} // namespace

spirv::SelectionOp
ControlFlowStructurizer::createSelectionOp(uint32_t selectionControl) {}

spirv::LoopOp ControlFlowStructurizer::createLoopOp(uint32_t loopControl) {}

void ControlFlowStructurizer::collectBlocksInConstruct() {}

LogicalResult ControlFlowStructurizer::structurize() {}

LogicalResult spirv::Deserializer::wireUpBlockArgument() {}

LogicalResult spirv::Deserializer::structurizeControlFlow() {}

//===----------------------------------------------------------------------===//
// Debug
//===----------------------------------------------------------------------===//

Location spirv::Deserializer::createFileLineColLoc(OpBuilder opBuilder) {}

LogicalResult
spirv::Deserializer::processDebugLine(ArrayRef<uint32_t> operands) {}

void spirv::Deserializer::clearDebugLine() {}

LogicalResult
spirv::Deserializer::processDebugString(ArrayRef<uint32_t> operands) {}