My Project
Public Member Functions | Static Public Member Functions | Friends | List of all members
mlir::FuncOp Class Reference

#include <Function.h>

Inheritance diagram for mlir::FuncOp:
Inheritance graph
[legend]
Collaboration diagram for mlir::FuncOp:
Collaboration graph
[legend]

Public Member Functions

void print (OpAsmPrinter &p)
 
LogicalResult verify ()
 
void eraseArgument (unsigned argIndex)
 Erase a single argument at argIndex. More...
 
void eraseArguments (ArrayRef< unsigned > argIndices)
 
FunctionType getType ()
 Returns the type of this function. More...
 
void setType (FunctionType newType)
 
FuncOp clone (BlockAndValueMapping &mapper)
 
FuncOp clone ()
 
void cloneInto (FuncOp dest, BlockAndValueMapping &mapper)
 
BlockaddEntryBlock ()
 
BlockaddBlock ()
 
RegiongetCallableRegion (CallInterfaceCallable callable)
 
void getCallableRegions (SmallVectorImpl< Region *> &callables)
 Returns all of the callable regions of this operation. More...
 
ArrayRef< TypegetCallableResults (Region *region)
 
- Public Member Functions inherited from mlir::Op< FuncOp, OpTrait::ZeroOperands, OpTrait::ZeroResult, OpTrait::IsIsolatedFromAbove, OpTrait::Symbol, OpTrait::FunctionLike, CallableOpInterface::Trait >
OperationgetOperation ()
 Return the operation that this refers to. More...
 
FuncOp clone ()
 Create a deep copy of this operation. More...
 
FuncOp cloneWithoutRegions ()
 
DialectgetDialect ()
 Return the dialect that this refers to. More...
 
RegiongetParentRegion ()
 Return the parent Region of this operation. More...
 
 Op ()
 This is a public constructor. Any op can be initialized to null. More...
 
 Op (std::nullptr_t)
 
 Op (Operation *state)
 
const void * getAsOpaquePointer () const
 Methods for supporting PointerLikeTypeTraits. More...
 
- Public Member Functions inherited from mlir::OpState
 operator bool ()
 Ops are pointer-like, so we allow implicit conversion to bool. More...
 
 operator Operation * () const
 This implicitly converts to Operation*. More...
 
OperationgetOperation ()
 Return the operation that this refers to. More...
 
OperationgetParentOp ()
 
template<typename OpTy >
OpTy getParentOfType ()
 Return the closest surrounding parent operation that is of type 'OpTy'. More...
 
MLIRContextgetContext ()
 Return the context this operation belongs to. More...
 
void print (raw_ostream &os, OpPrintingFlags flags=llvm::None)
 Print the operation to the given stream. More...
 
void dump ()
 Dump this operation. More...
 
Location getLoc ()
 The source location the operation was defined or derived from. More...
 
void setLoc (Location loc)
 
ArrayRef< NamedAttributegetAttrs ()
 Return all of the attributes on this operation. More...
 
dialect_attr_range getDialectAttrs ()
 Return a range corresponding to the dialect attributes for this operation. More...
 
dialect_attr_iterator dialect_attr_begin ()
 
dialect_attr_iterator dialect_attr_end ()
 
Attribute getAttr (StringRef name)
 Return an attribute with the specified name. More...
 
template<typename AttrClass >
AttrClass getAttrOfType (StringRef name)
 If the operation has an attribute of the specified type, return it. More...
 
void setAttr (Identifier name, Attribute value)
 
void setAttr (StringRef name, Attribute value)
 
void setAttrs (ArrayRef< NamedAttribute > attributes)
 Set the attributes held by this operation. More...
 
void setAttrs (NamedAttributeList newAttrs)
 
template<typename DialectAttrs >
void setDialectAttrs (DialectAttrs &&attrs)
 Set the dialect attributes for this operation, and preserve all dependent. More...
 
NamedAttributeList::RemoveResult removeAttr (Identifier name)
 
NamedAttributeList::RemoveResult removeAttr (StringRef name)
 
bool use_empty ()
 Return true if there are no users of any results of this operation. More...
 
void erase ()
 Remove this operation from its parent block and delete it. More...
 
InFlightDiagnostic emitOpError (const Twine &message={})
 
InFlightDiagnostic emitError (const Twine &message={})
 
InFlightDiagnostic emitWarning (const Twine &message={})
 
InFlightDiagnostic emitRemark (const Twine &message={})
 
template<typename FnT , typename RetT = detail::walkResultType<FnT>>
RetT walk (FnT &&callback)
 
- Public Member Functions inherited from mlir::FoldingHook< FuncOp, llvm::is_one_of< OpTrait::OneResult< FuncOp >, OpTrait::ZeroOperands< FuncOp >... >::value >
LogicalResult fold (ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results)
 

Static Public Member Functions

static StringRef getOperationName ()
 
static FuncOp create (Location location, StringRef name, FunctionType type, ArrayRef< NamedAttribute > attrs={})
 
static FuncOp create (Location location, StringRef name, FunctionType type, iterator_range< dialect_attr_iterator > attrs)
 
static FuncOp create (Location location, StringRef name, FunctionType type, ArrayRef< NamedAttribute > attrs, ArrayRef< NamedAttributeList > argAttrs)
 
static void build (Builder *builder, OperationState &result, StringRef name, FunctionType type, ArrayRef< NamedAttribute > attrs)
 
static void build (Builder *builder, OperationState &result, StringRef name, FunctionType type, ArrayRef< NamedAttribute > attrs, ArrayRef< NamedAttributeList > argAttrs)
 
static ParseResult parse (OpAsmParser &parser, OperationState &result)
 Operation hooks. More...
 
- Static Public Member Functions inherited from mlir::Op< FuncOp, OpTrait::ZeroOperands, OpTrait::ZeroResult, OpTrait::IsIsolatedFromAbove, OpTrait::Symbol, OpTrait::FunctionLike, CallableOpInterface::Trait >
static constexpr bool hasTrait ()
 Return if this operation contains the provided trait. More...
 
static bool classof (Operation *op)
 Return true if this "op class" can match against the specified operation. More...
 
static ParseResult parseAssembly (OpAsmParser &parser, OperationState &result)
 
static void printAssembly (Operation *op, OpAsmPrinter &p)
 
static LogicalResult verifyInvariants (Operation *op)
 
static AbstractOperation::OperationProperties getOperationProperties ()
 
static ConcreteOpType getFromOpaquePointer (const void *pointer)
 
- Static Public Member Functions inherited from mlir::OpState
static void getCanonicalizationPatterns (OwningRewritePatternList &results, MLIRContext *context)
 
- Static Public Member Functions inherited from mlir::OpTrait::ZeroOperands< FuncOp >
static LogicalResult verifyTrait (Operation *op)
 
- Static Public Member Functions inherited from mlir::FoldingHook< FuncOp, llvm::is_one_of< OpTrait::OneResult< FuncOp >, OpTrait::ZeroOperands< FuncOp >... >::value >
static LogicalResult foldHook (Operation *op, ArrayRef< Attribute > operands, SmallVectorImpl< OpFoldResult > &results)
 

Friends

class OpTrait::FunctionLike< FuncOp >
 

Additional Inherited Members

- Public Types inherited from mlir::Op< FuncOp, OpTrait::ZeroOperands, OpTrait::ZeroResult, OpTrait::IsIsolatedFromAbove, OpTrait::Symbol, OpTrait::FunctionLike, CallableOpInterface::Trait >
using ConcreteOpType = FuncOp
 
- Public Types inherited from mlir::OpState
using dialect_attr_iterator = Operation::dialect_attr_iterator
 A utility iterator that filters out non-dialect attributes. More...
 
using dialect_attr_range = Operation::dialect_attr_range
 
- Protected Member Functions inherited from mlir::OpState
LogicalResult verify ()
 
void print (OpAsmPrinter &p)
 
 OpState (Operation *state)
 
- Protected Member Functions inherited from mlir::OpTrait::TraitBase< FuncOp, ZeroOperands >
OperationgetOperation ()
 Return the ultimate Operation being worked on. More...
 
- Static Protected Member Functions inherited from mlir::OpState
static ParseResult parse (OpAsmParser &parser, OperationState &result)
 
- Static Protected Member Functions inherited from mlir::OpTrait::TraitBase< FuncOp, ZeroOperands >
static LogicalResult verifyTrait (Operation *op)
 
static AbstractOperation::OperationProperties getTraitProperties ()
 

Detailed Description

FuncOp represents a function, or an operation containing one region that forms a CFG(Control Flow Graph). The region of a function is not allowed to implicitly capture global values, and all external references must use Function arguments or attributes that establish a symbolic connection(e.g. symbols referenced by name via a string attribute).

Member Function Documentation

◆ addBlock()

Block * FuncOp::addBlock ( )

Add a normal block to the end of the function's block list. The function should at least already have an entry block.

◆ addEntryBlock()

Block * FuncOp::addEntryBlock ( )

Add an entry block to an empty function, and set up the block arguments to match the signature of the function. The newly inserted entry block is returned.

Add an entry block to an empty function, and set up the block arguments to match the signature of the function.

◆ build() [1/2]

void FuncOp::build ( Builder builder,
OperationState result,
StringRef  name,
FunctionType  type,
ArrayRef< NamedAttribute attrs 
)
static

◆ build() [2/2]

void FuncOp::build ( Builder builder,
OperationState result,
StringRef  name,
FunctionType  type,
ArrayRef< NamedAttribute attrs,
ArrayRef< NamedAttributeList argAttrs 
)
static

◆ clone() [1/2]

FuncOp FuncOp::clone ( BlockAndValueMapping mapper)

Create a deep copy of this function and all of its blocks, remapping any operands that use values outside of the function using the map that is provided (leaving them alone if no entry is present). If the mapper contains entries for function arguments, these arguments are not included in the new function. Replaces references to cloned sub-values with the corresponding value that is copied, and adds those mappings to the mapper.

Create a deep copy of this function and all of its blocks, remapping any operands that use values outside of the function using the map that is provided (leaving them alone if no entry is present). Replaces references to cloned sub-values with the corresponding value that is copied, and adds those mappings to the mapper.

Set the argument attributes for arguments that aren't being replaced.

Clone the current function into the new one and return it.

◆ clone() [2/2]

FuncOp FuncOp::clone ( )

◆ cloneInto()

void FuncOp::cloneInto ( FuncOp  dest,
BlockAndValueMapping mapper 
)

Clone the internal blocks and attributes from this function into dest. Any cloned blocks are appended to the back of dest. This function asserts that the attributes of the current function and dest are compatible.

Clone the internal blocks from this function into dest and all attributes from this function to dest.

◆ create() [1/3]

FuncOp FuncOp::create ( Location  location,
StringRef  name,
FunctionType  type,
ArrayRef< NamedAttribute attrs = {} 
)
static

◆ create() [2/3]

FuncOp FuncOp::create ( Location  location,
StringRef  name,
FunctionType  type,
iterator_range< dialect_attr_iterator attrs 
)
static

◆ create() [3/3]

FuncOp FuncOp::create ( Location  location,
StringRef  name,
FunctionType  type,
ArrayRef< NamedAttribute attrs,
ArrayRef< NamedAttributeList argAttrs 
)
static

◆ eraseArgument()

void mlir::FuncOp::eraseArgument ( unsigned  argIndex)
inline

Erase a single argument at argIndex.

◆ eraseArguments()

void FuncOp::eraseArguments ( ArrayRef< unsigned >  argIndices)

Erases the arguments listed in argIndices. argIndices is allowed to have duplicates and can be in any order.

◆ getCallableRegion()

Region* mlir::FuncOp::getCallableRegion ( CallInterfaceCallable  callable)
inline

Returns a region on the current operation that the given callable refers to. This may return null in the case of an external callable object, e.g. an external function.

◆ getCallableRegions()

void mlir::FuncOp::getCallableRegions ( SmallVectorImpl< Region *> &  callables)
inline

Returns all of the callable regions of this operation.

◆ getCallableResults()

ArrayRef<Type> mlir::FuncOp::getCallableResults ( Region region)
inline

Returns the results types that the given callable region produces when executed.

◆ getOperationName()

static StringRef mlir::FuncOp::getOperationName ( )
inlinestatic

◆ getType()

FunctionType mlir::FuncOp::getType ( )
inline

Returns the type of this function.

◆ parse()

ParseResult FuncOp::parse ( OpAsmParser parser,
OperationState result 
)
static

Operation hooks.

Parsing/Printing methods.

◆ print()

void FuncOp::print ( OpAsmPrinter p)

◆ setType()

void mlir::FuncOp::setType ( FunctionType  newType)
inline

Change the type of this function in place. This is an extremely dangerous operation and it is up to the caller to ensure that this is legal for this function, and to restore invariants:

  • the entry block args must be updated to match the function params.
  • the argument/result attributes may need an update: if the new type has less parameters we drop the extra attributes, if there are more parameters they won't have any attributes.

◆ verify()

LogicalResult FuncOp::verify ( )

Friends And Related Function Documentation

◆ OpTrait::FunctionLike< FuncOp >

friend class OpTrait::FunctionLike< FuncOp >
friend

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