My Project
Classes | Typedefs | Functions
mlir::impl Namespace Reference

Classes

class  VariadicFlag
 A named class for passing around the variadic flag. More...
 

Typedefs

using FuncTypeBuilder = function_ref< Type(Builder &, ArrayRef< Type >, ArrayRef< Type >, VariadicFlag, std::string &)>
 

Functions

void addArgAndResultAttrs (Builder &builder, OperationState &result, ArrayRef< SmallVector< NamedAttribute, 2 >> argAttrs, ArrayRef< SmallVector< NamedAttribute, 2 >> resultAttrs)
 
ParseResult parseFunctionSignature (OpAsmParser &parser, bool allowVariadic, SmallVectorImpl< OpAsmParser::OperandType > &argNames, SmallVectorImpl< Type > &argTypes, SmallVectorImpl< SmallVector< NamedAttribute, 2 >> &argAttrs, bool &isVariadic, SmallVectorImpl< Type > &resultTypes, SmallVectorImpl< SmallVector< NamedAttribute, 2 >> &resultAttrs)
 
ParseResult parseFunctionLikeOp (OpAsmParser &parser, OperationState &result, bool allowVariadic, FuncTypeBuilder funcTypeBuilder)
 
void printFunctionLikeOp (OpAsmPrinter &p, Operation *op, ArrayRef< Type > argTypes, bool isVariadic, ArrayRef< Type > resultTypes)
 
void printFunctionSignature (OpAsmPrinter &p, Operation *op, ArrayRef< Type > argTypes, bool isVariadic, ArrayRef< Type > resultTypes)
 
void printFunctionAttributes (OpAsmPrinter &p, Operation *op, unsigned numInputs, unsigned numResults, ArrayRef< StringRef > elided={})
 
StringRef getTypeAttrName ()
 Return the name of the attribute used for function types. More...
 
StringRef getArgAttrName (unsigned arg, SmallVectorImpl< char > &out)
 Return the name of the attribute used for function arguments. More...
 
StringRef getResultAttrName (unsigned arg, SmallVectorImpl< char > &out)
 Return the name of the attribute used for function results. More...
 
DictionaryAttr getArgAttrDict (Operation *op, unsigned index)
 
DictionaryAttr getResultAttrDict (Operation *op, unsigned index)
 
ArrayRef< NamedAttributegetArgAttrs (Operation *op, unsigned index)
 Return all of the attributes for the argument at 'index'. More...
 
ArrayRef< NamedAttributegetResultAttrs (Operation *op, unsigned index)
 Return all of the attributes for the result at 'index'. More...
 
void ensureRegionTerminator (Region &region, Location loc, function_ref< Operation *()> buildTerminatorOp)
 
template<typename OpTy >
void ensureRegionTerminator (Region &region, Builder &builder, Location loc)
 Templated version that fills the generates the provided operation type. More...
 
ParseResult parseOneResultOneOperandTypeOp (OpAsmParser &parser, OperationState &result)
 
void buildBinaryOp (Builder *builder, OperationState &result, Value lhs, Value rhs)
 
ParseResult parseOneResultSameOperandTypeOp (OpAsmParser &parser, OperationState &result)
 
void printOneResultOp (Operation *op, OpAsmPrinter &p)
 
void buildCastOp (Builder *builder, OperationState &result, Value source, Type destType)
 
ParseResult parseCastOp (OpAsmParser &parser, OperationState &result)
 
void printCastOp (Operation *op, OpAsmPrinter &p)
 
Value foldCastOp (Operation *op)
 

Typedef Documentation

◆ FuncTypeBuilder

Callback type for parseFunctionLikeOp, the callback should produce the type that will be associated with a function-like operation from lists of function arguments and results, VariadicFlag indicates whether the function should have variadic arguments; in case of error, it may populate the last argument with a message.

Function Documentation

◆ addArgAndResultAttrs()

void mlir::impl::addArgAndResultAttrs ( Builder builder,
OperationState result,
ArrayRef< SmallVector< NamedAttribute, 2 >>  argAttrs,
ArrayRef< SmallVector< NamedAttribute, 2 >>  resultAttrs 
)

Adds argument and result attributes, provided as argAttrs and resultAttrs arguments, to the list of operation attributes in result. Internally, argument and result attributes are stored as dict attributes with special names given by getResultAttrName, getArgumentAttrName.

◆ buildBinaryOp()

void mlir::impl::buildBinaryOp ( Builder builder,
OperationState result,
Value  lhs,
Value  rhs 
)

◆ buildCastOp()

void mlir::impl::buildCastOp ( Builder builder,
OperationState result,
Value  source,
Type  destType 
)

◆ ensureRegionTerminator() [1/2]

void mlir::impl::ensureRegionTerminator ( Region region,
Location  loc,
function_ref< Operation *()>  buildTerminatorOp 
)

Insert an operation, generated by buildTerminatorOp, at the end of the region's only block if it does not have a terminator already. If the region is empty, insert a new block first. buildTerminatorOp should return the terminator operation to insert.

◆ ensureRegionTerminator() [2/2]

template<typename OpTy >
void mlir::impl::ensureRegionTerminator ( Region region,
Builder builder,
Location  loc 
)

Templated version that fills the generates the provided operation type.

◆ foldCastOp()

Value mlir::impl::foldCastOp ( Operation op)

◆ getArgAttrDict()

DictionaryAttr mlir::impl::getArgAttrDict ( Operation op,
unsigned  index 
)
inline

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

◆ getArgAttrName()

StringRef mlir::impl::getArgAttrName ( unsigned  arg,
SmallVectorImpl< char > &  out 
)
inline

Return the name of the attribute used for function arguments.

◆ getArgAttrs()

ArrayRef<NamedAttribute> mlir::impl::getArgAttrs ( Operation op,
unsigned  index 
)
inline

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

◆ getResultAttrDict()

DictionaryAttr mlir::impl::getResultAttrDict ( Operation op,
unsigned  index 
)
inline

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

◆ getResultAttrName()

StringRef mlir::impl::getResultAttrName ( unsigned  arg,
SmallVectorImpl< char > &  out 
)
inline

Return the name of the attribute used for function results.

◆ getResultAttrs()

ArrayRef<NamedAttribute> mlir::impl::getResultAttrs ( Operation op,
unsigned  index 
)
inline

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

◆ getTypeAttrName()

StringRef mlir::impl::getTypeAttrName ( )
inline

Return the name of the attribute used for function types.

◆ parseCastOp()

ParseResult mlir::impl::parseCastOp ( OpAsmParser parser,
OperationState result 
)

◆ parseFunctionLikeOp()

ParseResult mlir::impl::parseFunctionLikeOp ( OpAsmParser parser,
OperationState result,
bool  allowVariadic,
FuncTypeBuilder  funcTypeBuilder 
)

Parser implementation for function-like operations. Uses funcTypeBuilder to construct the custom function type given lists of input and output types. If allowVariadic is set, the parser will accept trailing ellipsis in the function signature and indicate to the builder whether the function is variadic. If the builder returns a null type, result will not contain the type attribute. The caller can then add a type, report the error or delegate the reporting to the op's verifier.

Parser implementation for function-like operations. Uses funcTypeBuilder to construct the custom function type given lists of input and output types.

◆ parseFunctionSignature()

ParseResult mlir::impl::parseFunctionSignature ( OpAsmParser parser,
bool  allowVariadic,
SmallVectorImpl< OpAsmParser::OperandType > &  argNames,
SmallVectorImpl< Type > &  argTypes,
SmallVectorImpl< SmallVector< NamedAttribute, 2 >> &  argAttrs,
bool &  isVariadic,
SmallVectorImpl< Type > &  resultTypes,
SmallVectorImpl< SmallVector< NamedAttribute, 2 >> &  resultAttrs 
)

Parses a function signature using parser. The allowVariadic argument indicates whether functions with variadic arguments are supported. The trailing arguments are populated by this function with names, types and attributes of the arguments and those of the results.

◆ parseOneResultOneOperandTypeOp()

ParseResult mlir::impl::parseOneResultOneOperandTypeOp ( OpAsmParser parser,
OperationState result 
)

◆ parseOneResultSameOperandTypeOp()

ParseResult mlir::impl::parseOneResultSameOperandTypeOp ( OpAsmParser parser,
OperationState result 
)

◆ printCastOp()

void mlir::impl::printCastOp ( Operation op,
OpAsmPrinter p 
)

◆ printFunctionAttributes()

void mlir::impl::printFunctionAttributes ( OpAsmPrinter p,
Operation op,
unsigned  numInputs,
unsigned  numResults,
ArrayRef< StringRef >  elided = {} 
)

Prints the list of function prefixed with the "attributes" keyword. The attributes with names listed in "elided" as well as those used by the function-like operation internally are not printed. Nothing is printed if all attributes are elided. Assumes op has the FunctionLike trait and passed the verification.

◆ printFunctionLikeOp()

void mlir::impl::printFunctionLikeOp ( OpAsmPrinter p,
Operation op,
ArrayRef< Type argTypes,
bool  isVariadic,
ArrayRef< Type resultTypes 
)

Printer implementation for function-like operations. Accepts lists of argument and result types to use while printing.

◆ printFunctionSignature()

void mlir::impl::printFunctionSignature ( OpAsmPrinter p,
Operation op,
ArrayRef< Type argTypes,
bool  isVariadic,
ArrayRef< Type resultTypes 
)

Prints the signature of the function-like operation op. Assumes op has the FunctionLike trait and passed the verification.

Print the signature of the function-like operation op. Assumes op has the FunctionLike trait and passed the verification.

◆ printOneResultOp()

void mlir::impl::printOneResultOp ( Operation op,
OpAsmPrinter p 
)