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

#include <Builders.h>

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

Public Member Functions

 ValueHandle (Type t)
 
 ValueHandle (Value v)
 
 ValueHandle (index_t cst)
 
 ValueHandle (const ValueHandle &other)=default
 ValueHandle is a value type, use the default copy constructor. More...
 
ValueHandleoperator= (const ValueHandle &other)
 
void swap (ValueHandle &other)
 Provide a swap operator. More...
 
 operator Value () const
 Implicit conversion useful for automatic conversion to Container<Value>. More...
 
 operator bool () const
 
bool hasValue () const
 
Value getValue () const
 
bool hasType () const
 
Type getType () const
 
OperationgetOperation () const
 

Static Public Member Functions

static ValueHandle null ()
 A ValueHandle in a null state can never be captured;. More...
 
template<typename Op , typename... Args>
static ValueHandle create (Args... args)
 
template<typename Op , typename... Args>
static ValueHandle create (OperationFolder *folder, Args... args)
 
static ValueHandle createComposedAffineApply (AffineMap map, ArrayRef< Value > operands)
 Special case to build composed AffineApply operations. More...
 
static ValueHandle create (StringRef name, ArrayRef< ValueHandle > operands, ArrayRef< Type > resultTypes, ArrayRef< NamedAttribute > attributes={})
 Generic create for a named operation producing a single value. More...
 

Protected Member Functions

 ValueHandle ()
 
- Protected Member Functions inherited from mlir::edsc::CapturableHandle
 CapturableHandle ()=default
 

Protected Attributes

Type t
 
Value v
 

Detailed Description

ValueHandle implements a (potentially "delayed") typed Value abstraction. ValueHandle should be captured by pointer but otherwise passed by Value everywhere. A ValueHandle can have 3 states:

  1. null state (empty type and empty value), in which case it does not hold a value and must never hold a Value (now or in the future). This is used for MLIR operations with zero returns as well as the result of calling a NestedBuilder::operator(). In both cases the objective is to have an object that can be inserted in an ArrayRef<ValueHandle> to implement nesting;
  2. delayed state (empty value), in which case it represents an eagerly typed "delayed" value that can be hold a Value in the future;
  3. constructed state,in which case it holds a Value.

A ValueHandle is meant to capture a single Value and should be used for operations that have a single result. For convenience of use, we also include AffineForOp in this category although it does not return a value. In the case of AffineForOp, the captured Value is the loop induction variable.

Constructor & Destructor Documentation

◆ ValueHandle() [1/5]

mlir::edsc::ValueHandle::ValueHandle ( Type  t)
inlineexplicit

A ValueHandle that is constructed from a Type represents a typed "delayed" Value. A delayed Value can only capture Values of the specified type. Such a delayed value represents the declaration (in the PL sense) of a placeholder for an mlir::Value that will be constructed and captured at some later point in the program.

◆ ValueHandle() [2/5]

mlir::edsc::ValueHandle::ValueHandle ( Value  v)
inlineexplicit

A ValueHandle that is constructed from an mlir::Value is an "eager" Value. An eager Value represents both the declaration and the definition (in the PL sense) of a placeholder for an mlir::Value that has already been constructed in the past and that is captured "now" in the program.

◆ ValueHandle() [3/5]

mlir::edsc::ValueHandle::ValueHandle ( index_t  cst)

Builds a ConstantIndexOp of value cst. The constant is created at the current insertion point. This implicit constructor is provided to each build an eager Value for a constant at the current insertion point in the IR. An implicit constructor allows idiomatic expressions mixing ValueHandle and literals.

◆ ValueHandle() [4/5]

mlir::edsc::ValueHandle::ValueHandle ( const ValueHandle other)
default

ValueHandle is a value type, use the default copy constructor.

◆ ValueHandle() [5/5]

mlir::edsc::ValueHandle::ValueHandle ( )
inlineprotected

Member Function Documentation

◆ create() [1/3]

template<typename Op , typename... Args>
ValueHandle mlir::edsc::ValueHandle::create ( Args...  args)
static

Generic mlir::Op create. This is the key to being extensible to the whole of MLIR without duplicating the type system or the op definitions.

◆ create() [2/3]

template<typename Op , typename... Args>
ValueHandle mlir::edsc::ValueHandle::create ( OperationFolder folder,
Args...  args 
)
static

Generic mlir::Op create. This is the key to being extensible to the whole of MLIR without duplicating the type system or the op definitions. When non-null, the optional pointer folder is used to call into the createAndFold builder method. If folder is null, the regular create method is called.

◆ create() [3/3]

ValueHandle ValueHandle::create ( StringRef  name,
ArrayRef< ValueHandle operands,
ArrayRef< Type resultTypes,
ArrayRef< NamedAttribute attributes = {} 
)
static

Generic create for a named operation producing a single value.

◆ createComposedAffineApply()

ValueHandle mlir::edsc::ValueHandle::createComposedAffineApply ( AffineMap  map,
ArrayRef< Value operands 
)
static

Special case to build composed AffineApply operations.

◆ getOperation()

Operation* mlir::edsc::ValueHandle::getOperation ( ) const
inline

◆ getType()

Type mlir::edsc::ValueHandle::getType ( ) const
inline

◆ getValue()

Value mlir::edsc::ValueHandle::getValue ( ) const
inline

◆ hasType()

bool mlir::edsc::ValueHandle::hasType ( ) const
inline

◆ hasValue()

bool mlir::edsc::ValueHandle::hasValue ( ) const
inline

◆ null()

static ValueHandle mlir::edsc::ValueHandle::null ( )
inlinestatic

A ValueHandle in a null state can never be captured;.

◆ operator bool()

mlir::edsc::ValueHandle::operator bool ( ) const
inline

◆ operator Value()

mlir::edsc::ValueHandle::operator Value ( ) const
inline

Implicit conversion useful for automatic conversion to Container<Value>.

◆ operator=()

ValueHandle & mlir::edsc::ValueHandle::operator= ( const ValueHandle other)

ValueHandle is a value type, the assignment operator typechecks before assigning.

◆ swap()

void mlir::edsc::ValueHandle::swap ( ValueHandle other)
inline

Provide a swap operator.

Member Data Documentation

◆ t

Type mlir::edsc::ValueHandle::t
protected

◆ v

Value mlir::edsc::ValueHandle::v
protected

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