My Project
Public Member Functions | Static Public Member Functions | List of all members
mlir::edsc::LoopBuilder Class Reference

#include <Builders.h>

Inheritance diagram for mlir::edsc::LoopBuilder:
Inheritance graph
[legend]
Collaboration diagram for mlir::edsc::LoopBuilder:
Collaboration graph
[legend]

Public Member Functions

 LoopBuilder (const LoopBuilder &)=delete
 
 LoopBuilder (LoopBuilder &&)=default
 
LoopBuilderoperator= (const LoopBuilder &)=delete
 
LoopBuilderoperator= (LoopBuilder &&)=default
 
void operator() (function_ref< void(void)> fun=nullptr)
 

Static Public Member Functions

static LoopBuilder makeAffine (ValueHandle *iv, ArrayRef< ValueHandle > lbHandles, ArrayRef< ValueHandle > ubHandles, int64_t step)
 
static LoopBuilder makeLoop (ValueHandle *iv, ValueHandle lbHandle, ValueHandle ubHandle, ValueHandle stepHandle)
 

Additional Inherited Members

- Protected Member Functions inherited from mlir::edsc::NestedBuilder
 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 LoopBuilder is a generic NestedBuilder for loop-like MLIR operations. More specifically it is meant to be used as a temporary object for representing any nested MLIR construct that is "related to" an mlir::Value (for now an induction variable). This is extensible and will evolve in the future as MLIR evolves, hence the name LoopBuilder (as opposed to say ForBuilder or AffineForBuilder).

Constructor & Destructor Documentation

◆ LoopBuilder() [1/2]

mlir::edsc::LoopBuilder::LoopBuilder ( const LoopBuilder )
delete

◆ LoopBuilder() [2/2]

mlir::edsc::LoopBuilder::LoopBuilder ( LoopBuilder &&  )
default

Member Function Documentation

◆ makeAffine()

mlir::edsc::LoopBuilder mlir::edsc::LoopBuilder::makeAffine ( ValueHandle iv,
ArrayRef< ValueHandle lbHandles,
ArrayRef< ValueHandle ubHandles,
int64_t  step 
)
static

Constructs a new AffineForOp and captures the associated induction variable. A ValueHandle pointer is passed as the first argument and is the only way to capture the loop induction variable.

◆ makeLoop()

mlir::edsc::LoopBuilder mlir::edsc::LoopBuilder::makeLoop ( ValueHandle iv,
ValueHandle  lbHandle,
ValueHandle  ubHandle,
ValueHandle  stepHandle 
)
static

Constructs a new loop::ForOp and captures the associated induction variable. A ValueHandle pointer is passed as the first argument and is the only way to capture the loop induction variable.

◆ operator()()

void mlir::edsc::LoopBuilder::operator() ( function_ref< void(void)>  fun = nullptr)

The only purpose of this operator is to serve as a sequence point so that the evaluation of fun (which build IR snippets in a scoped fashion) is scoped within a LoopBuilder.

The particular use case concerns nested blocks:

{c++}
For (&i, lb, ub, 1)({
/--- destructor for this `For` is not always called before ...
V
For (&j1, lb, ub, 1)({
some_op_1,
}),
/--- ... this scope is entered, resulting in improperly nested IR.
V
For (&j2, lb, ub, 1)({
some_op_2,
}),
});

◆ operator=() [1/2]

LoopBuilder& mlir::edsc::LoopBuilder::operator= ( const LoopBuilder )
delete

◆ operator=() [2/2]

LoopBuilder& mlir::edsc::LoopBuilder::operator= ( LoopBuilder &&  )
default

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