MLIR  18.0.0git
Namespaces | Macros | Functions
SerializeOps.cpp File Reference
#include "Serializer.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVAttributes.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVEnums.h"
#include "mlir/IR/RegionGraphTraits.h"
#include "mlir/Support/LogicalResult.h"
#include "mlir/Target/SPIRV/SPIRVBinaryUtils.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Debug.h"
#include "mlir/Dialect/SPIRV/IR/"

Go to the source code of this file.


 Include the generated interface declarations.


#define DEBUG_TYPE   "spirv-serialization"


static LogicalResult visitInPrettyBlockOrder (Block *headerBlock, function_ref< LogicalResult(Block *)> blockHandler, bool skipHeader=false, BlockRange skipBlocks={})
 A pre-order depth-first visitor function for processing basic blocks. More...
LogicalResult mlir::spirv::Serializer::processOp< spirv::EntryPointOp > (spirv::EntryPointOp op)
LogicalResult mlir::spirv::Serializer::processOp< spirv::ExecutionModeOp > (spirv::ExecutionModeOp op)
LogicalResult mlir::spirv::Serializer::processOp< spirv::FunctionCallOp > (spirv::FunctionCallOp op)
LogicalResult mlir::spirv::Serializer::processOp< spirv::CopyMemoryOp > (spirv::CopyMemoryOp op)
LogicalResult mlir::spirv::Serializer::processOp< spirv::GenericCastToPtrExplicitOp > (spirv::GenericCastToPtrExplicitOp op)

Macro Definition Documentation


#define DEBUG_TYPE   "spirv-serialization"

Definition at line 24 of file SerializeOps.cpp.



Definition at line 751 of file SerializeOps.cpp.

Function Documentation

◆ visitInPrettyBlockOrder()

static LogicalResult visitInPrettyBlockOrder ( Block headerBlock,
function_ref< LogicalResult(Block *)>  blockHandler,
bool  skipHeader = false,
BlockRange  skipBlocks = {} 

A pre-order depth-first visitor function for processing basic blocks.

Visits the basic blocks starting from the given headerBlock in pre-order depth-first manner and calls blockHandler on each block. Skips handling blocks in the skipBlocks list. If skipHeader is true, blockHandler will not be invoked in headerBlock but still handles all headerBlock's successors.

SPIR-V spec "2.16.1. Universal Validation Rules" requires that "the order of blocks in a function must satisfy the rule that blocks appear before all blocks they dominate." This can be achieved by a pre-order CFG traversal algorithm. To make the serialization output more logical and readable to human, we perform depth-first CFG traversal and delay the serialization of the merge block and the continue block, if exists, until after all other blocks have been processed.

Definition at line 44 of file SerializeOps.cpp.