My Project
Protected Member Functions | List of all members
mlir::edsc::NestedBuilder Class Reference

#include <Builders.h>

Inheritance diagram for mlir::edsc::NestedBuilder:
Inheritance graph
[legend]

Protected Member Functions

 NestedBuilder ()=default
 
 NestedBuilder (const NestedBuilder &)=delete
 
 NestedBuilder (NestedBuilder &&other)
 
NestedBuilderoperator= (const NestedBuilder &)=delete
 
NestedBuilderoperator= (NestedBuilder &&other)
 
void enter (mlir::Block *block, int prev=0)
 
void exit ()
 
 ~NestedBuilder ()
 

Detailed Description

A NestedBuilder is a scoping abstraction to create an idiomatic syntax embedded in C++ that serves the purpose of building nested MLIR. Nesting and compositionality is obtained by using the strict ordering that exists between object construction and method invocation on said object (in our case, the call to operator()). This ordering allows implementing an abstraction that decouples definition from declaration (in a PL sense) on placeholders of type ValueHandle and BlockHandle.

Constructor & Destructor Documentation

◆ NestedBuilder() [1/3]

mlir::edsc::NestedBuilder::NestedBuilder ( )
protecteddefault

◆ NestedBuilder() [2/3]

mlir::edsc::NestedBuilder::NestedBuilder ( const NestedBuilder )
protecteddelete

◆ NestedBuilder() [3/3]

mlir::edsc::NestedBuilder::NestedBuilder ( NestedBuilder &&  other)
inlineprotected

◆ ~NestedBuilder()

mlir::edsc::NestedBuilder::~NestedBuilder ( )
inlineprotected

Custom destructor does nothing because we already destroyed bodyScope manually in exit. Insert an assertion to defensively guard against improper usage of scoping.

Member Function Documentation

◆ enter()

void mlir::edsc::NestedBuilder::enter ( mlir::Block block,
int  prev = 0 
)
inlineprotected

Enter an mlir::Block and setup a ScopedContext to insert operations at the end of it. Since we cannot use c++ language-level scoping to implement scoping itself, we use enter/exit pairs of operations. As a consequence we must allocate a new OpBuilder + ScopedContext and let the escape. Step back "prev" times from the end of the block to set up the insertion point, which is useful for non-empty blocks.

◆ exit()

void mlir::edsc::NestedBuilder::exit ( )
inlineprotected

Exit the current mlir::Block by explicitly deleting the dynamically allocated OpBuilder and ScopedContext.

◆ operator=() [1/2]

NestedBuilder& mlir::edsc::NestedBuilder::operator= ( const NestedBuilder )
protecteddelete

◆ operator=() [2/2]

NestedBuilder& mlir::edsc::NestedBuilder::operator= ( NestedBuilder &&  other)
inlineprotected

The documentation for this class was generated from the following file: