MLIR  20.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/Target/SPIRV/SPIRVBinaryUtils.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Debug.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVSerialization.inc"

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::spirv
 

Macros

#define DEBUG_TYPE   "spirv-serialization"
 
#define GET_SERIALIZATION_FNS
 

Functions

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...
 
template<>
LogicalResult mlir::spirv::Serializer::processOp< spirv::EntryPointOp > (spirv::EntryPointOp op)
 
template<>
LogicalResult mlir::spirv::Serializer::processOp< spirv::ExecutionModeOp > (spirv::ExecutionModeOp op)
 
template<>
LogicalResult mlir::spirv::Serializer::processOp< spirv::FunctionCallOp > (spirv::FunctionCallOp op)
 
template<>
LogicalResult mlir::spirv::Serializer::processOp< spirv::CopyMemoryOp > (spirv::CopyMemoryOp op)
 
template<>
LogicalResult mlir::spirv::Serializer::processOp< spirv::GenericCastToPtrExplicitOp > (spirv::GenericCastToPtrExplicitOp op)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "spirv-serialization"

Definition at line 23 of file SerializeOps.cpp.

◆ GET_SERIALIZATION_FNS

#define GET_SERIALIZATION_FNS

Definition at line 777 of file SerializeOps.cpp.

Function Documentation

◆ visitInPrettyBlockOrder()

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

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 43 of file SerializeOps.cpp.