My Project
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
mlir::OpTrait::FunctionLike< ConcreteType > Class Template Reference

#include <FunctionSupport.h>

Inheritance diagram for mlir::OpTrait::FunctionLike< ConcreteType >:
Inheritance graph
[legend]
Collaboration diagram for mlir::OpTrait::FunctionLike< ConcreteType >:
Collaboration graph
[legend]

Public Types

using BlockListType = Region::BlockListType
 This is the list of blocks in the function. More...
 
using iterator = BlockListType::iterator
 
using reverse_iterator = BlockListType::reverse_iterator
 
using args_iterator = Block::args_iterator
 

Public Member Functions

bool isExternal ()
 Returns true if this function is external, i.e. it has no body. More...
 
RegiongetBody ()
 
void eraseBody ()
 Delete all blocks from this function. More...
 
BlockListTypegetBlocks ()
 
iterator begin ()
 
iterator end ()
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
bool empty ()
 
void push_back (Block *block)
 
void push_front (Block *block)
 
Blockback ()
 
Blockfront ()
 
LogicalResult verifyBody ()
 
TypeAttr getTypeAttr ()
 
bool isTypeAttrValid ()
 
unsigned getNumArguments ()
 
unsigned getNumResults ()
 
BlockArgument getArgument (unsigned idx)
 Gets argument. More...
 
args_iterator args_begin ()
 
args_iterator args_end ()
 
iterator_range< args_iteratorgetArguments ()
 
ArrayRef< NamedAttributegetArgAttrs (unsigned index)
 Return all of the attributes for the argument at 'index'. More...
 
void getAllArgAttrs (SmallVectorImpl< NamedAttributeList > &result)
 Return all argument attributes of this function. More...
 
Attribute getArgAttr (unsigned index, Identifier name)
 
Attribute getArgAttr (unsigned index, StringRef name)
 
template<typename AttrClass >
AttrClass getArgAttrOfType (unsigned index, Identifier name)
 
template<typename AttrClass >
AttrClass getArgAttrOfType (unsigned index, StringRef name)
 
void setArgAttrs (unsigned index, ArrayRef< NamedAttribute > attributes)
 Set the attributes held by the argument at 'index'. More...
 
void setArgAttrs (unsigned index, NamedAttributeList attributes)
 
void setAllArgAttrs (ArrayRef< NamedAttributeList > attributes)
 
void setArgAttr (unsigned index, Identifier name, Attribute value)
 
void setArgAttr (unsigned index, StringRef name, Attribute value)
 
NamedAttributeList::RemoveResult removeArgAttr (unsigned index, Identifier name)
 Remove the attribute 'name' from the argument at 'index'. More...
 
ArrayRef< NamedAttributegetResultAttrs (unsigned index)
 Return all of the attributes for the result at 'index'. More...
 
void getAllResultAttrs (SmallVectorImpl< NamedAttributeList > &result)
 Return all result attributes of this function. More...
 
Attribute getResultAttr (unsigned index, Identifier name)
 
Attribute getResultAttr (unsigned index, StringRef name)
 
template<typename AttrClass >
AttrClass getResultAttrOfType (unsigned index, Identifier name)
 
template<typename AttrClass >
AttrClass getResultAttrOfType (unsigned index, StringRef name)
 
void setResultAttrs (unsigned index, ArrayRef< NamedAttribute > attributes)
 Set the attributes held by the result at 'index'. More...
 
void setResultAttrs (unsigned index, NamedAttributeList attributes)
 
void setAllResultAttrs (ArrayRef< NamedAttributeList > attributes)
 
void setResultAttr (unsigned index, Identifier name, Attribute value)
 
void setResultAttr (unsigned index, StringRef name, Attribute value)
 
NamedAttributeList::RemoveResult removeResultAttr (unsigned index, Identifier name)
 Remove the attribute 'name' from the result at 'index'. More...
 

Static Public Member Functions

static LogicalResult verifyTrait (Operation *op)
 Verify that all of the argument attributes are dialect attributes. More...
 
static StringRef getTypeAttrName ()
 Return the name of the attribute used for function types. More...
 

Protected Member Functions

DictionaryAttr getArgAttrDict (unsigned index)
 
DictionaryAttr getResultAttrDict (unsigned index)
 
LogicalResult verifyType ()
 
- Protected Member Functions inherited from mlir::OpTrait::TraitBase< ConcreteType, FunctionLike >
OperationgetOperation ()
 Return the ultimate Operation being worked on. More...
 

Static Protected Member Functions

static StringRef getArgAttrName (unsigned index, SmallVectorImpl< char > &out)
 
static StringRef getResultAttrName (unsigned index, SmallVectorImpl< char > &out)
 
- Static Protected Member Functions inherited from mlir::OpTrait::TraitBase< ConcreteType, FunctionLike >
static LogicalResult verifyTrait (Operation *op)
 
static AbstractOperation::OperationProperties getTraitProperties ()
 

Detailed Description

template<typename ConcreteType>
class mlir::OpTrait::FunctionLike< ConcreteType >

This trait provides APIs for Ops that behave like functions. In particular:

Member Typedef Documentation

◆ args_iterator

template<typename ConcreteType >
using mlir::OpTrait::FunctionLike< ConcreteType >::args_iterator = Block::args_iterator

◆ BlockListType

template<typename ConcreteType >
using mlir::OpTrait::FunctionLike< ConcreteType >::BlockListType = Region::BlockListType

This is the list of blocks in the function.

◆ iterator

template<typename ConcreteType >
using mlir::OpTrait::FunctionLike< ConcreteType >::iterator = BlockListType::iterator

◆ reverse_iterator

template<typename ConcreteType >
using mlir::OpTrait::FunctionLike< ConcreteType >::reverse_iterator = BlockListType::reverse_iterator

Member Function Documentation

◆ args_begin()

template<typename ConcreteType >
args_iterator mlir::OpTrait::FunctionLike< ConcreteType >::args_begin ( )
inline

◆ args_end()

template<typename ConcreteType >
args_iterator mlir::OpTrait::FunctionLike< ConcreteType >::args_end ( )
inline

◆ back()

template<typename ConcreteType >
Block& mlir::OpTrait::FunctionLike< ConcreteType >::back ( )
inline

◆ begin()

template<typename ConcreteType >
iterator mlir::OpTrait::FunctionLike< ConcreteType >::begin ( )
inline

◆ empty()

template<typename ConcreteType >
bool mlir::OpTrait::FunctionLike< ConcreteType >::empty ( )
inline

◆ end()

template<typename ConcreteType >
iterator mlir::OpTrait::FunctionLike< ConcreteType >::end ( )
inline

◆ eraseBody()

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::eraseBody ( )
inline

Delete all blocks from this function.

◆ front()

template<typename ConcreteType >
Block& mlir::OpTrait::FunctionLike< ConcreteType >::front ( )
inline

◆ getAllArgAttrs()

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::getAllArgAttrs ( SmallVectorImpl< NamedAttributeList > &  result)
inline

Return all argument attributes of this function.

◆ getAllResultAttrs()

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::getAllResultAttrs ( SmallVectorImpl< NamedAttributeList > &  result)
inline

Return all result attributes of this function.

◆ getArgAttr() [1/2]

template<typename ConcreteType >
Attribute mlir::OpTrait::FunctionLike< ConcreteType >::getArgAttr ( unsigned  index,
Identifier  name 
)
inline

Return the specified attribute, if present, for the argument at 'index', null otherwise.

◆ getArgAttr() [2/2]

template<typename ConcreteType >
Attribute mlir::OpTrait::FunctionLike< ConcreteType >::getArgAttr ( unsigned  index,
StringRef  name 
)
inline

◆ getArgAttrDict()

template<typename ConcreteType >
DictionaryAttr mlir::OpTrait::FunctionLike< ConcreteType >::getArgAttrDict ( unsigned  index)
inlineprotected

Returns the dictionary attribute corresponding to the argument at 'index'. If there are no argument attributes at 'index', a null attribute is returned.

◆ getArgAttrName()

template<typename ConcreteType >
static StringRef mlir::OpTrait::FunctionLike< ConcreteType >::getArgAttrName ( unsigned  index,
SmallVectorImpl< char > &  out 
)
inlinestaticprotected

Returns the attribute entry name for the set of argument attributes at 'index'.

◆ getArgAttrOfType() [1/2]

template<typename ConcreteType >
template<typename AttrClass >
AttrClass mlir::OpTrait::FunctionLike< ConcreteType >::getArgAttrOfType ( unsigned  index,
Identifier  name 
)
inline

◆ getArgAttrOfType() [2/2]

template<typename ConcreteType >
template<typename AttrClass >
AttrClass mlir::OpTrait::FunctionLike< ConcreteType >::getArgAttrOfType ( unsigned  index,
StringRef  name 
)
inline

◆ getArgAttrs()

template<typename ConcreteType >
ArrayRef<NamedAttribute> mlir::OpTrait::FunctionLike< ConcreteType >::getArgAttrs ( unsigned  index)
inline

Return all of the attributes for the argument at 'index'.

FunctionLike operations allow for attaching attributes to each of the respective function arguments. These argument attributes are stored as DictionaryAttrs in the main operation attribute dictionary. The name of these entries is arg followed by the index of the argument. These argument attribute dictionaries are optional, and will generally only exist if they are non-empty.

◆ getArgument()

template<typename ConcreteType >
BlockArgument mlir::OpTrait::FunctionLike< ConcreteType >::getArgument ( unsigned  idx)
inline

Gets argument.

◆ getArguments()

template<typename ConcreteType >
iterator_range<args_iterator> mlir::OpTrait::FunctionLike< ConcreteType >::getArguments ( )
inline

◆ getBlocks()

template<typename ConcreteType >
BlockListType& mlir::OpTrait::FunctionLike< ConcreteType >::getBlocks ( )
inline

◆ getBody()

template<typename ConcreteType >
Region& mlir::OpTrait::FunctionLike< ConcreteType >::getBody ( )
inline

◆ getNumArguments()

template<typename ConcreteType >
unsigned mlir::OpTrait::FunctionLike< ConcreteType >::getNumArguments ( )
inline

◆ getNumResults()

template<typename ConcreteType >
unsigned mlir::OpTrait::FunctionLike< ConcreteType >::getNumResults ( )
inline

◆ getResultAttr() [1/2]

template<typename ConcreteType >
Attribute mlir::OpTrait::FunctionLike< ConcreteType >::getResultAttr ( unsigned  index,
Identifier  name 
)
inline

Return the specified attribute, if present, for the result at 'index', null otherwise.

◆ getResultAttr() [2/2]

template<typename ConcreteType >
Attribute mlir::OpTrait::FunctionLike< ConcreteType >::getResultAttr ( unsigned  index,
StringRef  name 
)
inline

◆ getResultAttrDict()

template<typename ConcreteType >
DictionaryAttr mlir::OpTrait::FunctionLike< ConcreteType >::getResultAttrDict ( unsigned  index)
inlineprotected

Returns the dictionary attribute corresponding to the result at 'index'. If there are no result attributes at 'index', a null attribute is returned.

◆ getResultAttrName()

template<typename ConcreteType >
static StringRef mlir::OpTrait::FunctionLike< ConcreteType >::getResultAttrName ( unsigned  index,
SmallVectorImpl< char > &  out 
)
inlinestaticprotected

Returns the attribute entry name for the set of result attributes at 'index'.

◆ getResultAttrOfType() [1/2]

template<typename ConcreteType >
template<typename AttrClass >
AttrClass mlir::OpTrait::FunctionLike< ConcreteType >::getResultAttrOfType ( unsigned  index,
Identifier  name 
)
inline

◆ getResultAttrOfType() [2/2]

template<typename ConcreteType >
template<typename AttrClass >
AttrClass mlir::OpTrait::FunctionLike< ConcreteType >::getResultAttrOfType ( unsigned  index,
StringRef  name 
)
inline

◆ getResultAttrs()

template<typename ConcreteType >
ArrayRef<NamedAttribute> mlir::OpTrait::FunctionLike< ConcreteType >::getResultAttrs ( unsigned  index)
inline

Return all of the attributes for the result at 'index'.

FunctionLike operations allow for attaching attributes to each of the respective function results. These result attributes are stored as DictionaryAttrs in the main operation attribute dictionary. The name of these entries is result followed by the index of the result. These result attribute dictionaries are optional, and will generally only exist if they are non-empty.

◆ getTypeAttr()

template<typename ConcreteType >
TypeAttr mlir::OpTrait::FunctionLike< ConcreteType >::getTypeAttr ( )
inline

◆ getTypeAttrName()

template<typename ConcreteType >
static StringRef mlir::OpTrait::FunctionLike< ConcreteType >::getTypeAttrName ( )
inlinestatic

Return the name of the attribute used for function types.

◆ isExternal()

template<typename ConcreteType >
bool mlir::OpTrait::FunctionLike< ConcreteType >::isExternal ( )
inline

Returns true if this function is external, i.e. it has no body.

◆ isTypeAttrValid()

template<typename ConcreteType >
bool mlir::OpTrait::FunctionLike< ConcreteType >::isTypeAttrValid ( )
inline

◆ push_back()

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::push_back ( Block block)
inline

◆ push_front()

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::push_front ( Block block)
inline

◆ rbegin()

template<typename ConcreteType >
reverse_iterator mlir::OpTrait::FunctionLike< ConcreteType >::rbegin ( )
inline

◆ removeArgAttr()

template<typename ConcreteType >
NamedAttributeList::RemoveResult mlir::OpTrait::FunctionLike< ConcreteType >::removeArgAttr ( unsigned  index,
Identifier  name 
)

Remove the attribute 'name' from the argument at 'index'.

◆ removeResultAttr()

template<typename ConcreteType >
NamedAttributeList::RemoveResult mlir::OpTrait::FunctionLike< ConcreteType >::removeResultAttr ( unsigned  index,
Identifier  name 
)

Remove the attribute 'name' from the result at 'index'.

◆ rend()

template<typename ConcreteType >
reverse_iterator mlir::OpTrait::FunctionLike< ConcreteType >::rend ( )
inline

◆ setAllArgAttrs()

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::setAllArgAttrs ( ArrayRef< NamedAttributeList attributes)
inline

◆ setAllResultAttrs()

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::setAllResultAttrs ( ArrayRef< NamedAttributeList attributes)
inline

◆ setArgAttr() [1/2]

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::setArgAttr ( unsigned  index,
Identifier  name,
Attribute  value 
)

If the an attribute exists with the specified name, change it to the new value. Otherwise, add a new attribute with the specified name/value.

◆ setArgAttr() [2/2]

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::setArgAttr ( unsigned  index,
StringRef  name,
Attribute  value 
)
inline

◆ setArgAttrs() [1/2]

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::setArgAttrs ( unsigned  index,
ArrayRef< NamedAttribute attributes 
)

Set the attributes held by the argument at 'index'.

◆ setArgAttrs() [2/2]

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::setArgAttrs ( unsigned  index,
NamedAttributeList  attributes 
)

◆ setResultAttr() [1/2]

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::setResultAttr ( unsigned  index,
Identifier  name,
Attribute  value 
)

If the an attribute exists with the specified name, change it to the new value. Otherwise, add a new attribute with the specified name/value.

◆ setResultAttr() [2/2]

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::setResultAttr ( unsigned  index,
StringRef  name,
Attribute  value 
)
inline

◆ setResultAttrs() [1/2]

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::setResultAttrs ( unsigned  index,
ArrayRef< NamedAttribute attributes 
)

Set the attributes held by the result at 'index'.

◆ setResultAttrs() [2/2]

template<typename ConcreteType >
void mlir::OpTrait::FunctionLike< ConcreteType >::setResultAttrs ( unsigned  index,
NamedAttributeList  attributes 
)

◆ verifyBody()

template<typename ConcreteType >
LogicalResult mlir::OpTrait::FunctionLike< ConcreteType >::verifyBody ( )

Hook for concrete ops to verify the contents of the body. Called as a part of trait verification, after type verification and ensuring that a region exists.

Default verifier checks that if the entry block exists, it has the same number of arguments as the function-like operation.

◆ verifyTrait()

template<typename ConcreteType >
LogicalResult mlir::OpTrait::FunctionLike< ConcreteType >::verifyTrait ( Operation op)
static

Verify that all of the argument attributes are dialect attributes.

◆ verifyType()

template<typename ConcreteType >
LogicalResult mlir::OpTrait::FunctionLike< ConcreteType >::verifyType ( )
inlineprotected

Hook for concrete classes to verify that the type attribute respects op-specific invariants. Default implementation always succeeds.


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