MLIR 22.0.0git
mlir::detail Namespace Reference

AttrTypeReplacer. More...

Namespaces

namespace  analysis_impl
namespace  pass_options
namespace  storage_user_base_impl
namespace  StorageUserTrait

Classes

struct  AffineBinaryOpExprStorage
 A binary operation appearing in an affine expression. More...
struct  AffineConstantExprStorage
 An integer constant appearing in affine expression. More...
struct  AffineDimExprStorage
 A dimensional or symbolic identifier appearing in an affine expression. More...
struct  AffineExprStorage
 Base storage class appearing in an affine expression. More...
struct  AffineMapStorage
struct  AliasAnalysisTraits
 This class contains various internal trait classes used by the main AliasAnalysis class below. More...
struct  AnalysisConcept
 The abstract polymorphic base class representing an analysis. More...
class  AnalysisMap
 This class represents a cache of analyses for a single operation. More...
struct  AnalysisModel
 A derived analysis model used to hold a specific analysis object. More...
struct  AnyCapturedValueMatcher
 Terminal matcher, always returns true. More...
struct  AnyValueMatcher
 Terminal matcher, always returns true. More...
class  AsmParserImpl
 This class provides the implementation of the generic parser methods within AsmParser. More...
class  AsmStateImpl
struct  attr_value_binder
 The matcher that matches a certain kind of Attribute and binds the value inside the Attribute. More...
class  AttributeUniquer
struct  AttrOpBinder
 The matcher that matches operations that have the specified attribute name, and binds the attribute value. More...
struct  AttrOpMatcher
 The matcher that matches operations that have the specified attribute name. More...
class  AttrTypeReplacerBase
 This class provides a base utility for replacing attributes/types, and their sub elements. More...
class  BlockArgumentImpl
 The internal implementation of a BlockArgument. More...
class  CallbackOstream
 A simple raw ostream subclass that forwards write_impl calls to the user-supplied callback together with opaque user-supplied data. More...
struct  constant_float_predicate_matcher
 The matcher that matches a given target constant scalar / vector splat / tensor splat float value that fulfills a predicate. More...
struct  constant_float_value_binder
 The matcher that matches a constant scalar / vector splat / tensor splat float Attribute or Operation and binds the constant float value. More...
struct  constant_int_predicate_matcher
 The matcher that matches a given target constant scalar / vector splat / tensor splat integer value that fulfills a predicate. More...
struct  constant_int_range_predicate_matcher
 A matcher that matches a given a constant scalar / vector splat / tensor splat integer value or a constant integer range that fulfills a predicate. More...
struct  constant_int_value_binder
 The matcher that matches a constant scalar / vector splat / tensor splat integer Attribute or Operation and binds the constant integer value. More...
struct  constant_op_binder
 The matcher that matches operations that have the ConstantLike trait, and binds the folded attribute value. More...
struct  constant_op_matcher
 The matcher that matches operations that have the ConstantLike trait. More...
struct  ConversionPatternRewriterImpl
struct  count_if_t_impl
 Template utility that computes the number of elements within T that satisfy the given predicate. More...
struct  count_if_t_impl< Pred, N, T, Us... >
struct  CreateAlgebraicOpForEndomorphismSimplification
class  DataLayoutEntryAttrStorage
class  DefaultTimingManagerImpl
 Implementation details of the DefaultTimingManager. More...
class  DenseArrayAttrImpl
 Base class for DenseArrayAttr that is instantiated and specialized for each supported element type below. More...
class  DenseElementIndexedIteratorImpl
 Impl iterator for indexed DenseElementsAttr iterators that records a data pointer and data index that is adjusted for the case of a splat attribute. More...
struct  DenseElementsAttributeStorage
 An attribute representing a reference to a dense vector or tensor object. More...
struct  DenseIntOrFPElementsAttrStorage
 An attribute representing a reference to a dense vector or tensor object. More...
class  DenseResourceElementsAttrBase
 Base class for DenseResourceElementsAttr that is instantiated and specialized for each supported element type below. More...
struct  DenseStringElementsAttrStorage
 An attribute representing a reference to a dense vector or tensor object containing strings. More...
struct  DiagnosticEngineImpl
class  DialectInterfaceBase
 The base class used for all derived interface types. More...
class  DialectInterfaceCollectionBase
 This class is the base class for a collection of instances for a specific interface kind. More...
class  DistinctAttributeAllocator
 An allocator for distinct attribute storage instances. More...
class  DistinctAttributeUniquer
 A specialized attribute uniquer for distinct attributes that always allocates since the distinct attribute instances use the address of their storage as unique identifier. More...
struct  DistinctAttrStorage
 An attribute to store a distinct reference to another attribute. More...
class  DominanceInfoBase
struct  DynamicAttrStorage
 Storage of DynamicAttr. More...
struct  DynamicTypeStorage
 Storage of DynamicType. More...
struct  ElementsAttrIndexer
 This class provides support for indexing into the element range of an ElementsAttr. More...
class  ElementsAttrIterator
 This class implements a generic iterator for ElementsAttr. More...
class  ElementsAttrRange
 This class provides iterator utilities for an ElementsAttr range. More...
struct  ExpectedDiag
 This class represents an expected output diagnostic. More...
class  FallbackTypeIDResolver
 This class provides a fallback for resolving TypeIDs. More...
struct  FileLineColRangeAttrStorage
struct  FunctionTypeStorage
 Function Type Storage and Uniquing. More...
struct  infer_int_range_op_binder
 A matcher that matches operations that implement the InferIntRangeInterface interface, and binds the inferred range. More...
struct  InlineOpResult
 This class provides the implementation for an operation result whose index can be represented "inline" in the underlying ValueImpl. More...
struct  InlineTypeIDResolver
 This class provides utilities for resolving the TypeID of a class that provides a static TypeID resolveTypeID() method. More...
struct  IntegerSetStorage
struct  IntegerTypeStorage
 Integer Type Storage and Uniquing. More...
class  Interface
 This class represents an abstract interface. More...
class  InterfaceMap
 This class provides an efficient mapping between a given Interface type, and a particular implementation of its concept. More...
class  IROperandBase
 This class is the base for IROperand, and provides all of the non-templated facilities for operand use management. More...
struct  is_complex_t
 Type trait detector that checks if a given type T is a complex type. More...
struct  is_complex_t< std::complex< T > >
struct  is_fully_resolved_t
struct  is_pair
struct  is_pair< std::pair< Ts... > >
struct  is_tuple
struct  is_tuple< std::tuple< Ts... > >
struct  NameOpMatcher
 The matcher that matches operations that have the specified op name. More...
struct  NestedAnalysisMap
 An analysis map that contains a map for the current operation, and a set of maps for any child operations. More...
class  op_filter_iterator
 A utility iterator that filters out operations that are not 'OpT'. More...
class  op_iterator
 This class provides iteration over the held operations of a block for a specific operation type. More...
struct  op_matcher
 The matcher that matches a certain kind of op. More...
class  OperandStorage
 This class handles the management of operation operands. More...
struct  OpOrInterfaceRewritePatternBase
 OpOrInterfaceRewritePatternBase is a wrapper around RewritePattern that allows for matching and rewriting against an instance of a derived operation class or Interface. More...
struct  OpPassManagerImpl
class  OpResultImpl
 This class provides the implementation for an operation result. More...
class  OpToOpPassAdaptor
 An adaptor pass used to run operation passes over nested operations. More...
class  OutOfLineOpResult
 This class provides the implementation for an operation result whose index cannot be represented "inline", and thus requires an additional index field. More...
struct  ParallelDiagnosticHandlerImpl
class  Parser
 This class implement support for parsing global entities like attributes and types. More...
struct  ParserState
 This class refers to all of the state maintained globally by the parser, such as the current lexer position etc. More...
class  PassCrashReproducerGenerator
struct  PassExecutionState
 The state for a single execution of a pass. More...
struct  PassInstrumentorImpl
class  PassOptions
 Base container class and manager for all pass options. More...
struct  PassPipelineCLParserImpl
struct  PatternMatcherValue
 Binds to a specific value and matches it. More...
class  PDLByteCode
class  PDLByteCodeMutableState
class  PDLByteCodePattern
class  PreservedAnalyses
 A utility class to represent the analyses that are known to be preserved. More...
struct  RecoveryReproducerContext
 This class contains all of the context for generating a recovery reproducer. More...
struct  RecursivePatternMatcher
 RecursivePatternMatcher that composes. More...
struct  SourceMgrDiagnosticHandlerImpl
struct  SourceMgrDiagnosticVerifierHandlerImpl
struct  StorageUniquerImpl
 This is the implementation of the StorageUniquer class. More...
class  StorageUserBase
 Utility class for implementing users of storage classes uniqued by a StorageUniquer. More...
class  StorageUserTraitBase
 Helper class for implementing traits for storage classes. More...
struct  StringAttrStorage
struct  SymbolState
 This class contains record of any parsed top-level symbols. More...
class  TileOffsetRangeImpl
 Encapsulates the set of parameters that are used to make tile offset calculations in the TileOffsetRangeIterator. More...
class  TileOffsetRangeIterator
 The STL-style iterator implementation for StaticTileOffsetRange. More...
class  TimingManagerImpl
 Private implementation details of the TimingManager. More...
struct  TupleTypeStorage
 A type representing a collection of other types. More...
struct  TypedValue
 TypedValue is a Value with a statically know type. More...
class  TypeIDResolver
 This class provides a resolver for getting the ID for a given class T. More...
class  TypeIDResolver< T, std::enable_if_t< InlineTypeIDResolver::has_resolve_typeid< T >::value > >
 This class provides a resolver for getting the ID for a given class T, when the class provides a static TypeID resolveTypeID() method. More...
struct  TypeUniquer
 A utility class to get, or create, unique instances of types within an MLIRContext. More...
class  ValueImpl
 The base class for all derived Value classes. More...
struct  Vector1D
struct  Vector1D< T, Dim, false >
struct  Vector1D< T, Dim, true >

Typedefs

template<typename T>
using has_default_sub_element_handler_t = decltype(T::DefaultHandlerTag)
template<typename T, typename... Ts>
using has_get_method = decltype(T::get(std::declval<Ts>()...))
template<typename T, typename... Ts>
using has_get_as_key = decltype(std::declval<T>().getAsKey())
using DenseIterPtrAndSplat = std::pair<const char *, bool>
 Pair of raw pointer and a boolean flag of whether the pointer holds a splat,.
template<typename T>
using has_push_back_t
template<typename T, typename MatchTarget>
using has_compatible_matcher_t
 Trait to check whether T provides a 'match' method with type MatchTarget (Value, Operation, or Attribute).
template<typename T>
using first_argument = decltype(first_argument_type(std::declval<T>()))
 Type definition of the first argument to the given callable 'T'.
template<typename FnT>
using walkResultType = decltype(walk(nullptr, std::declval<FnT>()))
 Utility to provide the return type of a templated walk method.
template<template< class > class Pred, typename... Ts>
using count_if_t = count_if_t_impl<Pred, 0, Ts...>
template<typename T>
using is_interface_t = decltype(isInterfaceImpl(std::declval<T &>()))
template<typename T>
using IsInterface = llvm::is_detected<is_interface_t, T>
template<typename ImplTy, typename... Args>
using has_impltype_getkey_t = decltype(ImplTy::getKey(std::declval<Args>()...))
 Trait to check if ImplTy provides a 'getKey' method with types 'Args'.
template<typename ImplTy, typename T>
using has_impltype_hash_t = decltype(ImplTy::hashKey(std::declval<T>()))
 Trait to check if ImplTy provides a 'hashKey' method for 'T'.

Enumerations

enum class  OpProperties : char
 This is a "tag" used for mapping the properties storage in llvm::TrailingObjects. More...

Functions

constexpr bool isPowerOf2 (int n)
constexpr unsigned nextPowerOf2 (int n)
template<size_t N>
std::array< int64_t, N > makeStrides (ArrayRef< int64_t > shape)
 Given a shape with sizes greater than 0 along all dimensions, returns the distance, in number of elements, between a slice in a dimension and the next slice in the same dimension.
template<int N, typename T>
std::enable_if<(N >=1), StridedMemRefType< T, N > >::type makeStridedMemRefDescriptor (T *ptr, T *alignedPtr, ArrayRef< int64_t > shape, ArrayRef< int64_t > shapeAlloc)
 Build a StridedMemRefDescriptor<T, N> that matches the MLIR ABI.
template<int N, typename T>
std::enable_if<(N==0), StridedMemRefType< T, 0 > >::type makeStridedMemRefDescriptor (T *ptr, T *alignedPtr, ArrayRef< int64_t > shape={}, ArrayRef< int64_t > shapeAlloc={})
 Build a StridedMemRefDescriptor<T, 0> that matches the MLIR ABI.
template<typename T>
std::pair< T *, T * > allocAligned (size_t nElements, AllocFunType allocFun=&::malloc, std::optional< uint64_t > alignment=std::optional< uint64_t >())
 Align nElements of type T with an optional alignment.
std::optional< BlockArgumentgetBranchSuccessorArgument (const SuccessorOperands &operands, unsigned operandIndex, Block *successor)
 Return the BlockArgument corresponding to operand operandIndex in some successor if operandIndex is within the range of operands, or std::nullopt if operandIndex isn't a successor operand index.
LogicalResult verifyBranchSuccessorOperands (Operation *op, unsigned succNo, const SuccessorOperands &operands)
 Verify that the given operands match those of the given successor block.
LogicalResult verifyBranchWeights (Operation *op)
 Verify that the branch weights attached to an operation implementing WeightedBranchOpInterface are correct.
LogicalResult verifyRegionBranchWeights (Operation *op)
 Verify that the region weights attached to an operation implementing WeightedRegiobBranchOpInterface are correct.
LogicalResult verifyTypesAlongControlFlowEdges (Operation *op)
 Verify that types match along control flow edges described the given op.
llvm::TypeSize getDefaultTypeSize (Type type, const DataLayout &dataLayout, DataLayoutEntryListRef params)
 Default handler for the type size request.
llvm::TypeSize getDefaultTypeSizeInBits (Type type, const DataLayout &dataLayout, DataLayoutEntryListRef params)
 Default handler for the type size in bits request.
uint64_t getDefaultABIAlignment (Type type, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
 Default handler for the required alignment request.
uint64_t getDefaultPreferredAlignment (Type type, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
 Default handler for the preferred alignment request.
std::optional< uint64_t > getDefaultIndexBitwidth (Type type, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
 Default handler for the index bitwidth request.
Attribute getDefaultEndianness (DataLayoutEntryInterface entry)
 Default handler for endianness request.
Attribute getDefaultMemorySpace (DataLayoutEntryInterface entry)
 Default handler for the default memory space request.
Attribute getDefaultAllocaMemorySpace (DataLayoutEntryInterface entry)
 Default handler for alloca memory space request.
Attribute getDefaultManglingMode (DataLayoutEntryInterface entry)
 Default handler for mangling mode request.
Attribute getDefaultProgramMemorySpace (DataLayoutEntryInterface entry)
 Default handler for program memory space request.
Attribute getDefaultGlobalMemorySpace (DataLayoutEntryInterface entry)
 Default handler for global memory space request.
uint64_t getDefaultStackAlignment (DataLayoutEntryInterface entry)
 Default handler for the stack alignment request.
Attribute getDefaultFunctionPointerAlignment (DataLayoutEntryInterface entry)
 Default handler for the function pointer alignment request.
Attribute getDefaultLegalIntWidths (DataLayoutEntryInterface entry)
 Default handler for the legal int widths request.
std::optional< AttributegetDevicePropertyValue (DataLayoutEntryInterface entry)
 Returns the value of the property from the specified DataLayoutEntry.
DataLayoutEntryList filterEntriesForType (DataLayoutEntryListRef entries, TypeID typeID)
 Given a list of data layout entries, returns a new list containing the entries with keys having the given type ID, i.e.
DataLayoutEntryInterface filterEntryForIdentifier (DataLayoutEntryListRef entries, StringAttr id)
 Given a list of data layout entries, returns the entry that has the given identifier as key, if such an entry exists in the list.
TargetDeviceSpecInterface filterEntryForIdentifier (TargetDeviceSpecListRef entries, StringAttr id)
 Given a list of target device entries, returns the entry that has the given identifier as key, if such an entry exists in the list.
LogicalResult verifyDataLayoutOp (Operation *op)
 Verifies that the operation implementing the data layout interface, or a module operation, is valid.
LogicalResult verifyDataLayoutSpec (DataLayoutSpecInterface spec, Location loc)
 Verifies that a data layout spec is valid.
LogicalResult verifyTargetSystemSpec (TargetSystemSpecInterface spec, Location loc)
 Verifies that a target system desc spec is valid.
llvm::TypeSize divideCeil (llvm::TypeSize numerator, uint64_t denominator)
 Divides the known min value of the numerator by the denominator and rounds the result up to the next integer.
LogicalResult verifyDestinationStyleOpInterface (Operation *op)
 Verify that op conforms to the invariants of DestinationStyleOpInterface.
LogicalResult verifyIndexingMapOpInterface (Operation *op)
 Verify that op conforms to the invariants of StructuredOpInterface.
LogicalResult inferReturnTensorTypes (ArrayRef< ShapedTypeComponents > retComponents, SmallVectorImpl< Type > &inferredReturnTypes)
LogicalResult verifyInferredResultTypes (Operation *op)
 Verifies that the inferred result types match the actual result types for the op.
void reportFatalInferReturnTypesError (OperationState &state)
 Report a fatal error indicating that the result types could not be inferred.
LogicalResult verifyLoopLikeOpInterface (Operation *op)
 Verify invariants of the LoopLikeOpInterface.
LogicalResult verifyMemorySpaceCastOpInterface (Operation *op)
 Attempt to verify the given memory space cast operation.
FailureOr< std::optional< SmallVector< Value > > > bubbleDownInPlaceMemorySpaceCastImpl (OpOperand &operand, ValueRange results)
 Tries to bubble-down inplace a MemorySpaceCastOpInterface operation referenced by operand.
LogicalResult verifyInParallelOpInterface (Operation *op)
LogicalResult verifyShapedDimOpInterface (Operation *op)
 Verify invariants of ops that implement the ShapedDimOpInterface.
OpOperanddefaultGetDestinationOperand (Operation *op)
 Return the destination/"init" operand of the op if it implements the DestinationStyleOpInterface and has exactly one "init" operand.
OpResult defaultGetUpdatedDestination (Operation *op)
 Return the updated destination result of the op if it implements the DestinationStyleOpInterface.
bool defaultIsEquivalentSubset (Operation *op, Value candidate, function_ref< bool(Value, Value)> equivalenceFn)
 Default implementation of SubsetInsertionOpInterface::isEquivalentSubset.
bool defaultOperatesOnEquivalentSubset (Operation *op, SubsetOpInterface candidate, function_ref< bool(Value, Value)> equivalenceFn)
 Default implementation of SubsetOpInterface::operatesOnEquivalentSubset.
bool defaultOperatesOnDisjointSubset (Operation *op, SubsetOpInterface candidate, function_ref< bool(Value, Value)> equivalenceFn)
 Default implementation of SubsetOpInterface::operatesOnDisjointSubset.
Value getTensorContainer (Operation *op)
 Return the container that the given subset op is operating on.
LogicalResult verifySubsetOpInterface (SubsetOpInterface op)
 Verify SubsetOpInterface.
LogicalResult verifySubsetExtractionOpInterface (SubsetExtractionOpInterface op)
 Verify SubsetExtractionOpInterface.
LogicalResult verifyOffsetSizeAndStrideOp (OffsetSizeAndStrideOpInterface op)
bool sameOffsetsSizesAndStrides (OffsetSizeAndStrideOpInterface a, OffsetSizeAndStrideOpInterface b, llvm::function_ref< bool(OpFoldResult, OpFoldResult)> cmp)
unsigned getNumDynamicEntriesUpToIdx (ArrayRef< int64_t > staticVals, unsigned idx)
 Helper method to compute the number of dynamic entries of staticVals, up to idx.
template<int N>
void bindDims (MLIRContext *ctx)
template<int N, typename AffineExprTy, typename... AffineExprTy2>
void bindDims (MLIRContext *ctx, AffineExprTy &e, AffineExprTy2 &...exprs)
template<int N>
void bindSymbols (MLIRContext *ctx)
template<int N, typename AffineExprTy, typename... AffineExprTy2>
void bindSymbols (MLIRContext *ctx, AffineExprTy &e, AffineExprTy2 &...exprs)
template<class T>
decltype(auto) unwrapForCustomParse (FailureOr< T > &failureOr)
template<typename T>
void walkImmediateSubElementsImpl (T derived, function_ref< void(Attribute)> walkAttrsFn, function_ref< void(Type)> walkTypesFn)
 This function provides the underlying implementation for the SubElementInterface walk method, using the key type of the derived attribute/type to interact with the individual parameters.
template<typename T, typename... Ts>
auto constructSubElementReplacement (MLIRContext *ctx, Ts &&...params)
 This function invokes the proper get method for a type T with the given values.
template<typename T>
auto replaceImmediateSubElementsImpl (T derived, ArrayRef< Attribute > &replAttrs, ArrayRef< Type > &replTypes)
 This function provides the underlying implementation for the SubElementInterface replace method, using the key type of the derived attribute/type to interact with the individual parameters.
LogicalResult verifyAffineMapAsLayout (AffineMap m, ArrayRef< int64_t > shape, function_ref< InFlightDiagnostic()> emitError)
LogicalResult getAffineMapStridesAndOffset (AffineMap map, ArrayRef< int64_t > shape, SmallVectorImpl< int64_t > &strides, int64_t &offset)
template<typename MatcherClass>
std::enable_if_t< llvm::is_detected< detail::has_compatible_matcher_t, MatcherClass, Value >::value, boolmatchOperandOrValueAtIndex (Operation *op, unsigned idx, MatcherClass &matcher)
 Statically switch to a Value matcher.
template<typename MatcherClass>
std::enable_if_t< llvm::is_detected< detail::has_compatible_matcher_t, MatcherClass, Operation * >::value, boolmatchOperandOrValueAtIndex (Operation *op, unsigned idx, MatcherClass &matcher)
 Statically switch to an Operation matcher.
template<typename TupleT, class CallbackT, std::size_t... Is>
constexpr void enumerateImpl (TupleT &&tuple, CallbackT &&callback, std::index_sequence< Is... >)
template<typename... Tys, typename CallbackT>
constexpr void enumerate (std::tuple< Tys... > &tuple, CallbackT &&callback)
llvm::unique_function< InFlightDiagnostic()> getDefaultDiagnosticEmitFn (MLIRContext *ctx)
 Utility method to generate a callback that can be used to generate a diagnostic when checking the construction invariants of a storage object.
llvm::unique_function< InFlightDiagnostic()> getDefaultDiagnosticEmitFn (const Location &loc)
LogicalResult verifySymbolTable (Operation *op)
LogicalResult verifySymbol (Operation *op)
template<typename Ret, typename Arg, typename... Rest>
Arg first_argument_type (Ret(*)(Arg, Rest...))
 Helper templates to deduce the first argument of a callback parameter.
template<typename Ret, typename F, typename Arg, typename... Rest>
Arg first_argument_type (Ret(F::*)(Arg, Rest...))
template<typename F>
decltype(first_argument_type(&F::operator())) first_argument_type (F)
template<typename Iterator>
void walk (Operation *op, function_ref< void(Region *)> callback, WalkOrder order)
 Walk all of the regions, blocks, or operations nested under (and including) the given operation.
template<typename Iterator>
void walk (Operation *op, function_ref< void(Block *)> callback, WalkOrder order)
template<typename Iterator>
void walk (Operation *op, function_ref< void(Operation *)> callback, WalkOrder order)
template<typename Iterator>
WalkResult walk (Operation *op, function_ref< WalkResult(Region *)> callback, WalkOrder order)
 Walk all of the regions, blocks, or operations nested under (and including) the given operation.
template<typename Iterator>
WalkResult walk (Operation *op, function_ref< WalkResult(Block *)> callback, WalkOrder order)
template<typename Iterator>
WalkResult walk (Operation *op, function_ref< WalkResult(Operation *)> callback, WalkOrder order)
template<WalkOrder Order = WalkOrder::PostOrder, typename Iterator = ForwardIterator, typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()(std::declval<ArgT>()))>
std::enable_if_t< llvm::is_one_of< ArgT, Operation *, Region *, Block * >::value, RetT > walk (Operation *op, FuncTy &&callback)
 Walk all of the regions, blocks, or operations nested under (and including) the given operation.
template<WalkOrder Order = WalkOrder::PostOrder, typename Iterator = ForwardIterator, typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()(std::declval<ArgT>()))>
std::enable_if_t< !llvm::is_one_of< ArgT, Operation *, Region *, Block * >::value &&std::is_same< RetT, void >::value, RetT > walk (Operation *op, FuncTy &&callback)
 Walk all of the operations of type 'ArgT' nested under and including the given operation.
template<WalkOrder Order = WalkOrder::PostOrder, typename Iterator = ForwardIterator, typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()(std::declval<ArgT>()))>
std::enable_if_t< !llvm::is_one_of< ArgT, Operation *, Region *, Block * >::value &&std::is_same< RetT, WalkResult >::value, RetT > walk (Operation *op, FuncTy &&callback)
 Walk all of the operations of type 'ArgT' nested under and including the given operation.
void walk (Operation *op, function_ref< void(Operation *, const WalkStage &stage)> callback)
 Generic walkers with stage aware callbacks.
WalkResult walk (Operation *op, function_ref< WalkResult(Operation *, const WalkStage &stage)> callback)
 Walk all the operations nested under (and including) the given operation, with the callback being invoked on each operation N+1 times, where N is the number of regions attached to the operation.
template<typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()( std::declval<ArgT>(), std::declval<const WalkStage &>()))>
std::enable_if_t< std::is_same< ArgT, Operation * >::value, RetT > walk (Operation *op, FuncTy &&callback)
 Walk all of the operations nested under and including the given operation.
template<typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()( std::declval<ArgT>(), std::declval<const WalkStage &>()))>
std::enable_if_t<!std::is_same< ArgT, Operation * >::value &&std::is_same< RetT, void >::value, RetT > walk (Operation *op, FuncTy &&callback)
 Walk all of the operations of type 'ArgT' nested under and including the given operation.
template<typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()( std::declval<ArgT>(), std::declval<const WalkStage &>()))>
std::enable_if_t<!std::is_same< ArgT, Operation * >::value &&std::is_same< RetT, WalkResult >::value, RetT > walk (Operation *op, FuncTy &&callback)
 Walk all of the operations of type 'ArgT' nested under and including the given operation.
template<typename ContainerOpT>
OwningOpRef< ContainerOpT > constructContainerOpForParserIfNecessary (Block *parsedBlock, MLIRContext *context, Location sourceFileLoc)
 Given a block containing operations that have just been parsed, if the block contains a single operation of ContainerOpT type then remove it from the block and return it.
template<typename ContainerOpT, typename... ParserArgs>
OwningOpRef< ContainerOpT > parseSourceFile (const ParserConfig &config, ParserArgs &&...args)
 The internal implementation of the templated parseSourceFile methods below, that simply forwards to the non-templated version.
template<typename ConcreteType, typename ValueT, typename Traits, typename BaseType, template< typename, template< typename > class > class BaseTrait>
void isInterfaceImpl (Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait > &)
template<typename T>
constexpr bool is_fully_resolved ()
template<typename Range>
void printDimensionList (raw_ostream &stream, Range &&shape)
size_t getDenseElementBitWidth (Type eltType)
 Return the bit width which DenseElementsAttr should use for this type.
bool isSupportedMemorySpace (Attribute memorySpace)
 Checks if the memorySpace has supported Attribute type.
Attribute wrapIntegerMemorySpace (unsigned memorySpace, MLIRContext *ctx)
 Wraps deprecated integer memory space to the new Attribute form.
Attribute skipDefaultMemorySpace (Attribute memorySpace)
 Replaces default memorySpace (integer == 0) with empty Attribute.
unsigned getMemorySpaceAsInt (Attribute memorySpace)
 [deprecated] Returns the memory space in old raw integer representation.

Detailed Description

AttrTypeReplacer.

Detect if any of the given parameter types has a sub-element handler.

Typedef Documentation

◆ count_if_t

template<template< class > class Pred, typename... Ts>
using mlir::detail::count_if_t = count_if_t_impl<Pred, 0, Ts...>

Definition at line 153 of file InterfaceSupport.h.

◆ DenseIterPtrAndSplat

using mlir::detail::DenseIterPtrAndSplat = std::pair<const char *, bool>

Pair of raw pointer and a boolean flag of whether the pointer holds a splat,.

Definition at line 46 of file BuiltinAttributes.h.

◆ first_argument

template<typename T>
using mlir::detail::first_argument = decltype(first_argument_type(std::declval<T>()))

Type definition of the first argument to the given callable 'T'.

Definition at line 90 of file Visitors.h.

◆ has_compatible_matcher_t

template<typename T, typename MatchTarget>
using mlir::detail::has_compatible_matcher_t
Initial value:
decltype(std::declval<T>().match(std::declval<MatchTarget>()))

Trait to check whether T provides a 'match' method with type MatchTarget (Value, Operation, or Attribute).

Definition at line 290 of file Matchers.h.

◆ has_default_sub_element_handler_t

template<typename T>
using mlir::detail::has_default_sub_element_handler_t = decltype(T::DefaultHandlerTag)

Definition at line 414 of file AttrTypeSubElements.h.

◆ has_get_as_key

template<typename T, typename... Ts>
using mlir::detail::has_get_as_key = decltype(std::declval<T>().getAsKey())

Definition at line 512 of file AttrTypeSubElements.h.

◆ has_get_method

template<typename T, typename... Ts>
using mlir::detail::has_get_method = decltype(T::get(std::declval<Ts>()...))

Definition at line 510 of file AttrTypeSubElements.h.

◆ has_impltype_getkey_t

template<typename ImplTy, typename... Args>
using mlir::detail::has_impltype_getkey_t = decltype(ImplTy::getKey(std::declval<Args>()...))

Trait to check if ImplTy provides a 'getKey' method with types 'Args'.

Definition at line 26 of file StorageUniquer.h.

◆ has_impltype_hash_t

template<typename ImplTy, typename T>
using mlir::detail::has_impltype_hash_t = decltype(ImplTy::hashKey(std::declval<T>()))

Trait to check if ImplTy provides a 'hashKey' method for 'T'.

Definition at line 30 of file StorageUniquer.h.

◆ has_push_back_t

template<typename T>
using mlir::detail::has_push_back_t
Initial value:
decltype(std::declval<T>().push_back(
std::declval<typename T::value_type &&>()))

Definition at line 168 of file DialectImplementation.h.

◆ is_interface_t

template<typename T>
using mlir::detail::is_interface_t = decltype(isInterfaceImpl(std::declval<T &>()))

Definition at line 274 of file InterfaceSupport.h.

◆ IsInterface

template<typename T>
using mlir::detail::IsInterface = llvm::is_detected<is_interface_t, T>

Definition at line 277 of file InterfaceSupport.h.

◆ walkResultType

template<typename FnT>
using mlir::detail::walkResultType = decltype(walk(nullptr, std::declval<FnT>()))

Utility to provide the return type of a templated walk method.

Definition at line 431 of file Visitors.h.

Enumeration Type Documentation

◆ OpProperties

enum class mlir::detail::OpProperties : char
strong

This is a "tag" used for mapping the properties storage in llvm::TrailingObjects.

Definition at line 28 of file Operation.h.

Function Documentation

◆ allocAligned()

template<typename T>
std::pair< T *, T * > mlir::detail::allocAligned ( size_t nElements,
AllocFunType allocFun = &::malloc,
std::optional< uint64_t > alignment = std::optional<uint64_t>() )

Align nElements of type T with an optional alignment.

This replaces a portable posix_memalign. alignment must be a power of 2 and greater than the size of T. By default the alignment is sizeof(T).

Definition at line 104 of file MemRefUtils.h.

References nextPowerOf2(), and rem.

◆ bindDims() [1/2]

template<int N>
void mlir::detail::bindDims ( MLIRContext * ctx)

Definition at line 289 of file AffineExpr.h.

Referenced by mlir::bindDims(), and bindDims().

◆ bindDims() [2/2]

template<int N, typename AffineExprTy, typename... AffineExprTy2>
void mlir::detail::bindDims ( MLIRContext * ctx,
AffineExprTy & e,
AffineExprTy2 &... exprs )

Definition at line 292 of file AffineExpr.h.

References bindDims(), and mlir::getAffineDimExpr().

◆ bindSymbols() [1/2]

template<int N>
void mlir::detail::bindSymbols ( MLIRContext * ctx)

Definition at line 298 of file AffineExpr.h.

Referenced by mlir::bindSymbols(), and bindSymbols().

◆ bindSymbols() [2/2]

template<int N, typename AffineExprTy, typename... AffineExprTy2>
void mlir::detail::bindSymbols ( MLIRContext * ctx,
AffineExprTy & e,
AffineExprTy2 &... exprs )

Definition at line 301 of file AffineExpr.h.

References bindSymbols(), and mlir::getAffineSymbolExpr().

◆ bubbleDownInPlaceMemorySpaceCastImpl()

FailureOr< std::optional< SmallVector< Value > > > mlir::detail::bubbleDownInPlaceMemorySpaceCastImpl ( OpOperand & operand,
ValueRange results )

Tries to bubble-down inplace a MemorySpaceCastOpInterface operation referenced by operand.

On success, it returns std::nullopt. It returns failure if operand doesn't reference a MemorySpaceCastOpInterface op.

Definition at line 59 of file MemOpInterfaces.cpp.

References mlir::IROperand< DerivedT, IRValueT >::get(), and mlir::IROperand< DerivedT, IRValueT >::set().

◆ constructContainerOpForParserIfNecessary()

template<typename ContainerOpT>
OwningOpRef< ContainerOpT > mlir::detail::constructContainerOpForParserIfNecessary ( Block * parsedBlock,
MLIRContext * context,
Location sourceFileLoc )
inline

Given a block containing operations that have just been parsed, if the block contains a single operation of ContainerOpT type then remove it from the block and return it.

If the block does not contain just that operation, create a new operation instance of ContainerOpT and move all of the operations within parsedBlock into the first block of the first region. ContainerOpT is required to have a single region containing a single block, and must implement the SingleBlockImplicitTerminator trait.

Definition at line 38 of file Parser.h.

References mlir::Block::begin(), mlir::emitError(), mlir::Block::front(), and mlir::Block::getOperations().

Referenced by parseSourceFile(), and mlir::parseSourceString().

◆ constructSubElementReplacement()

template<typename T, typename... Ts>
auto mlir::detail::constructSubElementReplacement ( MLIRContext * ctx,
Ts &&... params )

This function invokes the proper get method for a type T with the given values.

Definition at line 539 of file AttrTypeSubElements.h.

Referenced by replaceImmediateSubElementsImpl().

◆ defaultGetDestinationOperand()

OpOperand & mlir::detail::defaultGetDestinationOperand ( Operation * op)

Return the destination/"init" operand of the op if it implements the DestinationStyleOpInterface and has exactly one "init" operand.

Asserts otherwise.

Definition at line 17 of file SubsetOpInterface.cpp.

References defaultGetDestinationOperand().

Referenced by defaultGetDestinationOperand().

◆ defaultGetUpdatedDestination()

OpResult mlir::detail::defaultGetUpdatedDestination ( Operation * op)

Return the updated destination result of the op if it implements the DestinationStyleOpInterface.

Definition at line 26 of file SubsetOpInterface.cpp.

References defaultGetUpdatedDestination().

Referenced by defaultGetUpdatedDestination().

◆ defaultIsEquivalentSubset()

bool mlir::detail::defaultIsEquivalentSubset ( Operation * op,
Value candidate,
function_ref< bool(Value, Value)> equivalenceFn )

Default implementation of SubsetInsertionOpInterface::isEquivalentSubset.

Definition at line 33 of file SubsetOpInterface.cpp.

References defaultIsEquivalentSubset(), and mlir::Value::getDefiningOp().

Referenced by defaultIsEquivalentSubset().

◆ defaultOperatesOnDisjointSubset()

bool mlir::detail::defaultOperatesOnDisjointSubset ( Operation * op,
SubsetOpInterface candidate,
function_ref< bool(Value, Value)> equivalenceFn )

Default implementation of SubsetOpInterface::operatesOnDisjointSubset.

Definition at line 65 of file SubsetOpInterface.cpp.

References mlir::ValueBoundsConstraintSet::areOverlappingSlices(), defaultOperatesOnDisjointSubset(), and mlir::Operation::getContext().

Referenced by defaultOperatesOnDisjointSubset().

◆ defaultOperatesOnEquivalentSubset()

bool mlir::detail::defaultOperatesOnEquivalentSubset ( Operation * op,
SubsetOpInterface candidate,
function_ref< bool(Value, Value)> equivalenceFn )

Default implementation of SubsetOpInterface::operatesOnEquivalentSubset.

Definition at line 44 of file SubsetOpInterface.cpp.

References mlir::ValueBoundsConstraintSet::areEquivalentSlices(), defaultOperatesOnEquivalentSubset(), and mlir::Operation::getContext().

Referenced by defaultOperatesOnEquivalentSubset().

◆ divideCeil()

llvm::TypeSize mlir::detail::divideCeil ( llvm::TypeSize numerator,
uint64_t denominator )

Divides the known min value of the numerator by the denominator and rounds the result up to the next integer.

Preserves the scalable flag.

Definition at line 465 of file DataLayoutInterfaces.cpp.

Referenced by getDefaultTypeSize().

◆ enumerate()

template<typename... Tys, typename CallbackT>
void mlir::detail::enumerate ( std::tuple< Tys... > & tuple,
CallbackT && callback )
constexpr

◆ enumerateImpl()

template<typename TupleT, class CallbackT, std::size_t... Is>
void mlir::detail::enumerateImpl ( TupleT && tuple,
CallbackT && callback,
std::index_sequence< Is... >  )
constexpr

Definition at line 336 of file Matchers.h.

Referenced by enumerate().

◆ filterEntriesForType()

DataLayoutEntryList mlir::detail::filterEntriesForType ( DataLayoutEntryListRef entries,
TypeID typeID )

Given a list of data layout entries, returns a new list containing the entries with keys having the given type ID, i.e.

belonging to the same type class.

Definition at line 343 of file DataLayoutInterfaces.cpp.

◆ filterEntryForIdentifier() [1/2]

DataLayoutEntryInterface mlir::detail::filterEntryForIdentifier ( DataLayoutEntryListRef entries,
StringAttr id )

Given a list of data layout entries, returns the entry that has the given identifier as key, if such an entry exists in the list.

Definition at line 353 of file DataLayoutInterfaces.cpp.

◆ filterEntryForIdentifier() [2/2]

TargetDeviceSpecInterface mlir::detail::filterEntryForIdentifier ( TargetDeviceSpecListRef entries,
StringAttr id )

Given a list of target device entries, returns the entry that has the given identifier as key, if such an entry exists in the list.

◆ first_argument_type() [1/3]

template<typename F>
decltype(first_argument_type(&F::operator())) mlir::detail::first_argument_type ( F )

◆ first_argument_type() [2/3]

template<typename Ret, typename Arg, typename... Rest>
Arg mlir::detail::first_argument_type ( Ret(*  )(Arg, Rest...))

Helper templates to deduce the first argument of a callback parameter.

◆ first_argument_type() [3/3]

template<typename Ret, typename F, typename Arg, typename... Rest>
Arg mlir::detail::first_argument_type ( Ret(F::*  )(Arg, Rest...))

◆ getAffineMapStridesAndOffset()

LogicalResult mlir::detail::getAffineMapStridesAndOffset ( AffineMap map,
ArrayRef< int64_t > shape,
SmallVectorImpl< int64_t > & strides,
int64_t & offset )

Definition at line 202 of file BuiltinAttributeInterfaces.cpp.

References getStridesAndOffset(), and success().

◆ getBranchSuccessorArgument()

std::optional< BlockArgument > mlir::detail::getBranchSuccessorArgument ( const SuccessorOperands & operands,
unsigned operandIndex,
Block * successor )

Return the BlockArgument corresponding to operand operandIndex in some successor if operandIndex is within the range of operands, or std::nullopt if operandIndex isn't a successor operand index.

Returns the BlockArgument corresponding to operand operandIndex in some successor if 'operandIndex' is within the range of 'operands', or std::nullopt if operandIndex isn't a successor operand index.

Definition at line 41 of file ControlFlowInterfaces.cpp.

References mlir::Block::getArgument(), mlir::OperandRange::getBeginOperandIndex(), mlir::SuccessorOperands::getForwardedOperands(), and mlir::SuccessorOperands::getProducedOperandCount().

◆ getDefaultABIAlignment()

uint64_t mlir::detail::getDefaultABIAlignment ( Type type,
const DataLayout & dataLayout,
ArrayRef< DataLayoutEntryInterface > params )

Default handler for the required alignment request.

Computes results for built-in types and dispatches to the DataLayoutTypeInterface for other types.

Definition at line 140 of file DataLayoutInterfaces.cpp.

References mlir::Type::getContext(), getDefaultABIAlignment(), getFloatTypeABIAlignment(), getIndexBitwidth(), getIntegerTypeABIAlignment(), mlir::DataLayout::getTypeABIAlignment(), mlir::DataLayout::getTypeSize(), and reportMissingDataLayout().

Referenced by getDefaultABIAlignment(), and mlir::DataLayout::getTypeABIAlignment().

◆ getDefaultAllocaMemorySpace()

Attribute mlir::detail::getDefaultAllocaMemorySpace ( DataLayoutEntryInterface entry)

Default handler for alloca memory space request.

Dispatches to the DataLayoutInterface if specified, otherwise returns the default.

Definition at line 263 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getAllocaMemorySpace().

◆ getDefaultDiagnosticEmitFn() [1/2]

llvm::unique_function< InFlightDiagnostic()> mlir::detail::getDefaultDiagnosticEmitFn ( const Location & loc)

Definition at line 1275 of file MLIRContext.cpp.

References mlir::emitError().

◆ getDefaultDiagnosticEmitFn() [2/2]

llvm::unique_function< InFlightDiagnostic()> mlir::detail::getDefaultDiagnosticEmitFn ( MLIRContext * ctx)

Utility method to generate a callback that can be used to generate a diagnostic when checking the construction invariants of a storage object.

This is defined out-of-line to avoid the need to include Location.h.

Definition at line 1271 of file MLIRContext.cpp.

References mlir::emitError().

Referenced by mlir::detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::AttributeUniquer, Traits... >::get(), mlir::DynamicType::get(), and mlir::detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::AttributeUniquer, Traits... >::getChecked().

◆ getDefaultEndianness()

Attribute mlir::detail::getDefaultEndianness ( DataLayoutEntryInterface entry)

Default handler for endianness request.

Dispatches to the DataLayoutInterface if specified, otherwise returns the default.

Definition at line 242 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getEndianness().

◆ getDefaultFunctionPointerAlignment()

Attribute mlir::detail::getDefaultFunctionPointerAlignment ( DataLayoutEntryInterface entry)

Default handler for the function pointer alignment request.

Dispatches to the DataLayoutInterface if specified, otherwise returns the default.

Definition at line 317 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getFunctionPointerAlignment().

◆ getDefaultGlobalMemorySpace()

Attribute mlir::detail::getDefaultGlobalMemorySpace ( DataLayoutEntryInterface entry)

Default handler for global memory space request.

Dispatches to the DataLayoutInterface if specified, otherwise returns the default.

Definition at line 296 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getGlobalMemorySpace().

◆ getDefaultIndexBitwidth()

std::optional< uint64_t > mlir::detail::getDefaultIndexBitwidth ( Type type,
const DataLayout & dataLayout,
ArrayRef< DataLayoutEntryInterface > params )

Default handler for the index bitwidth request.

Computes the result for the built-in index type and dispatches to the DataLayoutTypeInterface for other types.

Definition at line 224 of file DataLayoutInterfaces.cpp.

References getIndexBitwidth().

Referenced by mlir::DataLayout::getTypeIndexBitwidth().

◆ getDefaultLegalIntWidths()

Attribute mlir::detail::getDefaultLegalIntWidths ( DataLayoutEntryInterface entry)

Default handler for the legal int widths request.

Dispatches to the DataLayoutInterface if specified, otherwise returns the default.

Definition at line 328 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getLegalIntWidths().

◆ getDefaultManglingMode()

Attribute mlir::detail::getDefaultManglingMode ( DataLayoutEntryInterface entry)

Default handler for mangling mode request.

Dispatches to the DataLayoutInterface if specified, otherwise returns the default.

Definition at line 273 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getManglingMode().

◆ getDefaultMemorySpace()

Attribute mlir::detail::getDefaultMemorySpace ( DataLayoutEntryInterface entry)

Default handler for the default memory space request.

Dispatches to the DataLayoutInterface if specified, otherwise returns the default.

Definition at line 252 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getDefaultMemorySpace().

◆ getDefaultPreferredAlignment()

uint64_t mlir::detail::getDefaultPreferredAlignment ( Type type,
const DataLayout & dataLayout,
ArrayRef< DataLayoutEntryInterface > params )

◆ getDefaultProgramMemorySpace()

Attribute mlir::detail::getDefaultProgramMemorySpace ( DataLayoutEntryInterface entry)

Default handler for program memory space request.

Dispatches to the DataLayoutInterface if specified, otherwise returns the default.

Definition at line 284 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getProgramMemorySpace().

◆ getDefaultStackAlignment()

uint64_t mlir::detail::getDefaultStackAlignment ( DataLayoutEntryInterface entry)

Default handler for the stack alignment request.

Dispatches to the DataLayoutInterface if specified, otherwise returns the default.

Definition at line 307 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getStackAlignment().

◆ getDefaultTypeSize()

llvm::TypeSize mlir::detail::getDefaultTypeSize ( Type type,
const DataLayout & dataLayout,
DataLayoutEntryListRef params )

Default handler for the type size request.

Computes results for built-in types and dispatches to the DataLayoutTypeInterface for other types.

Definition at line 45 of file DataLayoutInterfaces.cpp.

References divideCeil(), and getDefaultTypeSizeInBits().

Referenced by mlir::DataLayout::getTypeSize().

◆ getDefaultTypeSizeInBits()

llvm::TypeSize mlir::detail::getDefaultTypeSizeInBits ( Type type,
const DataLayout & dataLayout,
DataLayoutEntryListRef params )

◆ getDenseElementBitWidth()

◆ getDevicePropertyValue()

std::optional< Attribute > mlir::detail::getDevicePropertyValue ( DataLayoutEntryInterface entry)

Returns the value of the property from the specified DataLayoutEntry.

If the property is missing from the entry, returns std::nullopt.

Definition at line 335 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getDevicePropertyValue().

◆ getMemorySpaceAsInt()

unsigned mlir::detail::getMemorySpaceAsInt ( Attribute memorySpace)

[deprecated] Returns the memory space in old raw integer representation.

New Attribute getMemorySpace() method should be used instead.

Definition at line 554 of file BuiltinTypes.cpp.

◆ getNumDynamicEntriesUpToIdx()

unsigned mlir::detail::getNumDynamicEntriesUpToIdx ( ArrayRef< int64_t > staticVals,
unsigned idx )

Helper method to compute the number of dynamic entries of staticVals, up to idx.

Definition at line 294 of file ViewLikeInterface.cpp.

◆ getTensorContainer()

Value mlir::detail::getTensorContainer ( Operation * op)

Return the container that the given subset op is operating on.

Definition at line 86 of file SubsetOpInterface.cpp.

References getTensorContainer().

Referenced by getTensorContainer().

◆ inferReturnTensorTypes()

LogicalResult mlir::detail::inferReturnTensorTypes ( ArrayRef< ShapedTypeComponents > retComponents,
SmallVectorImpl< Type > & inferredReturnTypes )

Definition at line 227 of file InferTypeOpInterface.cpp.

References success().

◆ is_fully_resolved()

template<typename T>
bool mlir::detail::is_fully_resolved ( )
constexpr

◆ isInterfaceImpl()

template<typename ConcreteType, typename ValueT, typename Traits, typename BaseType, template< typename, template< typename > class > class BaseTrait>
void mlir::detail::isInterfaceImpl ( Interface< ConcreteType, ValueT, Traits, BaseType, BaseTrait > & )

References isInterfaceImpl().

Referenced by isInterfaceImpl().

◆ isPowerOf2()

bool mlir::detail::isPowerOf2 ( int n)
constexpr

Definition at line 47 of file CRunnerUtils.h.

Referenced by nextPowerOf2().

◆ isSupportedMemorySpace()

bool mlir::detail::isSupportedMemorySpace ( Attribute memorySpace)

Checks if the memorySpace has supported Attribute type.

Definition at line 522 of file BuiltinTypes.cpp.

References mlir::Attribute::getDialect().

◆ makeStridedMemRefDescriptor() [1/2]

template<int N, typename T>
std::enable_if<(N >=1), StridedMemRefType< T, N > >::type mlir::detail::makeStridedMemRefDescriptor ( T * ptr,
T * alignedPtr,
ArrayRef< int64_t > shape,
ArrayRef< int64_t > shapeAlloc )

Build a StridedMemRefDescriptor<T, N> that matches the MLIR ABI.

This is an implementation detail that is kept in sync with MLIR codegen conventions. Additionally takes a shapeAlloc array which is used instead of shape to allocate "more aligned" data and compute the corresponding strides.

Definition at line 66 of file MemRefUtils.h.

References StridedMemRefType< T, N >::basePtr, StridedMemRefType< T, N >::data, makeStrides(), StridedMemRefType< T, N >::offset, StridedMemRefType< T, N >::sizes, and StridedMemRefType< T, N >::strides.

◆ makeStridedMemRefDescriptor() [2/2]

template<int N, typename T>
std::enable_if<(N==0), StridedMemRefType< T, 0 > >::type mlir::detail::makeStridedMemRefDescriptor ( T * ptr,
T * alignedPtr,
ArrayRef< int64_t > shape = {},
ArrayRef< int64_t > shapeAlloc = {} )

Build a StridedMemRefDescriptor<T, 0> that matches the MLIR ABI.

This is an implementation detail that is kept in sync with MLIR codegen conventions. Additionally takes a shapeAlloc array which is used instead of shape to allocate "more aligned" data and compute the corresponding strides.

Definition at line 87 of file MemRefUtils.h.

◆ makeStrides()

template<size_t N>
std::array< int64_t, N > mlir::detail::makeStrides ( ArrayRef< int64_t > shape)
inline

Given a shape with sizes greater than 0 along all dimensions, returns the distance, in number of elements, between a slice in a dimension and the next slice in the same dimension.

e.g. shape[3, 4, 5] -> strides[20, 5, 1]

Definition at line 46 of file MemRefUtils.h.

Referenced by makeStridedMemRefDescriptor().

◆ matchOperandOrValueAtIndex() [1/2]

template<typename MatcherClass>
std::enable_if_t< llvm::is_detected< detail::has_compatible_matcher_t, MatcherClass, Value >::value, bool > mlir::detail::matchOperandOrValueAtIndex ( Operation * op,
unsigned idx,
MatcherClass & matcher )

Statically switch to a Value matcher.

Definition at line 298 of file Matchers.h.

References mlir::Operation::getOperand().

Referenced by mlir::detail::RecursivePatternMatcher< OpType, OperandMatchers >::match().

◆ matchOperandOrValueAtIndex() [2/2]

template<typename MatcherClass>
std::enable_if_t< llvm::is_detected< detail::has_compatible_matcher_t, MatcherClass, Operation * >::value, bool > mlir::detail::matchOperandOrValueAtIndex ( Operation * op,
unsigned idx,
MatcherClass & matcher )

Statically switch to an Operation matcher.

Definition at line 307 of file Matchers.h.

References mlir::Value::getDefiningOp(), and mlir::Operation::getOperand().

◆ nextPowerOf2()

unsigned mlir::detail::nextPowerOf2 ( int n)
constexpr

◆ parseSourceFile()

template<typename ContainerOpT, typename... ParserArgs>
OwningOpRef< ContainerOpT > mlir::detail::parseSourceFile ( const ParserConfig & config,
ParserArgs &&... args )
inline

The internal implementation of the templated parseSourceFile methods below, that simply forwards to the non-templated version.

Definition at line 154 of file Parser.h.

References mlir::config, constructContainerOpForParserIfNecessary(), and parseSourceFile().

Referenced by parseSourceFile(), mlir::parseSourceFile(), mlir::parseSourceFile(), mlir::parseSourceFile(), mlir::parseSourceFile(), and mlir::parseSourceFile().

◆ printDimensionList()

template<typename Range>
void mlir::detail::printDimensionList ( raw_ostream & stream,
Range && shape )

◆ replaceImmediateSubElementsImpl()

template<typename T>
auto mlir::detail::replaceImmediateSubElementsImpl ( T derived,
ArrayRef< Attribute > & replAttrs,
ArrayRef< Type > & replTypes )

This function provides the underlying implementation for the SubElementInterface replace method, using the key type of the derived attribute/type to interact with the individual parameters.

Definition at line 557 of file AttrTypeSubElements.h.

References constructSubElementReplacement(), and mlir::has_sub_attr_or_type_v.

◆ reportFatalInferReturnTypesError()

void mlir::detail::reportFatalInferReturnTypesError ( OperationState & state)

◆ sameOffsetsSizesAndStrides()

bool mlir::detail::sameOffsetsSizesAndStrides ( OffsetSizeAndStrideOpInterface a,
OffsetSizeAndStrideOpInterface b,
llvm::function_ref< bool(OpFoldResult, OpFoldResult)> cmp )

Definition at line 273 of file ViewLikeInterface.cpp.

References b.

◆ skipDefaultMemorySpace()

Attribute mlir::detail::skipDefaultMemorySpace ( Attribute memorySpace)

Replaces default memorySpace (integer == 0) with empty Attribute.

Definition at line 546 of file BuiltinTypes.cpp.

◆ unwrapForCustomParse()

template<class T>
decltype(auto) mlir::detail::unwrapForCustomParse ( FailureOr< T > & failureOr)

Definition at line 316 of file AttributeSupport.h.

◆ verifyAffineMapAsLayout()

LogicalResult mlir::detail::verifyAffineMapAsLayout ( AffineMap m,
ArrayRef< int64_t > shape,
function_ref< InFlightDiagnostic()> emitError )

◆ verifyBranchSuccessorOperands()

LogicalResult mlir::detail::verifyBranchSuccessorOperands ( Operation * op,
unsigned succNo,
const SuccessorOperands & operands )

◆ verifyBranchWeights()

LogicalResult mlir::detail::verifyBranchWeights ( Operation * op)

Verify that the branch weights attached to an operation implementing WeightedBranchOpInterface are correct.

Definition at line 134 of file ControlFlowInterfaces.cpp.

References mlir::Operation::getNumSuccessors(), and verifyWeights().

◆ verifyDataLayoutOp()

LogicalResult mlir::detail::verifyDataLayoutOp ( Operation * op)

Verifies that the operation implementing the data layout interface, or a module operation, is valid.

This calls the verifier of the spec attribute and checks if the layout is compatible with specs attached to the enclosing operations.

Definition at line 443 of file DataLayoutInterfaces.cpp.

References collectParentLayouts(), diag(), mlir::Operation::emitError(), getCombinedDataLayout(), mlir::Operation::getLoc(), getSpec(), and success().

◆ verifyDataLayoutSpec()

LogicalResult mlir::detail::verifyDataLayoutSpec ( DataLayoutSpecInterface spec,
Location loc )

Verifies that a data layout spec is valid.

This dispatches to individual entry verifiers, and then to the verifiers implemented by the relevant type and dialect interfaces for type and identifier keys respectively.

Definition at line 797 of file DataLayoutInterfaces.cpp.

References mlir::emitError(), mlir::Dialect::getNamespace(), and success().

◆ verifyDestinationStyleOpInterface()

LogicalResult mlir::detail::verifyDestinationStyleOpInterface ( Operation * op)

Verify that op conforms to the invariants of DestinationStyleOpInterface.

Definition at line 29 of file DestinationStyleOpInterface.cpp.

References mlir::Operation::emitOpError(), result, success(), and verifyDestinationStyleOpInterface().

Referenced by verifyDestinationStyleOpInterface().

◆ verifyIndexingMapOpInterface()

LogicalResult mlir::detail::verifyIndexingMapOpInterface ( Operation * op)

Verify that op conforms to the invariants of StructuredOpInterface.

◆ verifyInferredResultTypes()

LogicalResult mlir::detail::verifyInferredResultTypes ( Operation * op)

Verifies that the inferred result types match the actual result types for the op.

Precondition: op implements InferTypeOpInterface.

Definition at line 246 of file InferTypeOpInterface.cpp.

References mlir::Operation::emitOpError(), mlir::Operation::getContext(), mlir::Operation::getLoc(), mlir::Operation::getOperands(), mlir::Operation::getPropertiesStorage(), mlir::Operation::getRawDictionaryAttrs(), mlir::Operation::getRegions(), mlir::Operation::getResultTypes(), and result.

◆ verifyInParallelOpInterface()

LogicalResult mlir::detail::verifyInParallelOpInterface ( Operation * op)

◆ verifyLoopLikeOpInterface()

LogicalResult mlir::detail::verifyLoopLikeOpInterface ( Operation * op)

Verify invariants of the LoopLikeOpInterface.

Definition at line 55 of file LoopLikeInterface.cpp.

References mlir::Operation::emitOpError(), mlir::getType(), success(), and verifyLoopLikeOpInterface().

Referenced by verifyLoopLikeOpInterface().

◆ verifyMemorySpaceCastOpInterface()

LogicalResult mlir::detail::verifyMemorySpaceCastOpInterface ( Operation * op)

Attempt to verify the given memory space cast operation.

Definition at line 17 of file MemOpInterfaces.cpp.

References mlir::Operation::emitError(), mlir::Operation::getNumResults(), mlir::Value::getType(), mlir::Type::getTypeID(), and success().

◆ verifyOffsetSizeAndStrideOp()

LogicalResult mlir::detail::verifyOffsetSizeAndStrideOp ( OffsetSizeAndStrideOpInterface op)

Definition at line 96 of file ViewLikeInterface.cpp.

References success(), and mlir::verifyListOfOperandsOrIntegers().

◆ verifyRegionBranchWeights()

LogicalResult mlir::detail::verifyRegionBranchWeights ( Operation * op)

Verify that the region weights attached to an operation implementing WeightedRegiobBranchOpInterface are correct.

Definition at line 145 of file ControlFlowInterfaces.cpp.

References mlir::Operation::getNumRegions(), and verifyWeights().

◆ verifyShapedDimOpInterface()

LogicalResult mlir::detail::verifyShapedDimOpInterface ( Operation * op)

Verify invariants of ops that implement the ShapedDimOpInterface.

Definition at line 17 of file ShapedOpInterfaces.cpp.

References mlir::Operation::emitError(), mlir::Operation::getNumResults(), mlir::Operation::getResult(), mlir::Value::getType(), mlir::Type::isIndex(), and success().

◆ verifySubsetExtractionOpInterface()

LogicalResult mlir::detail::verifySubsetExtractionOpInterface ( SubsetExtractionOpInterface op)

Verify SubsetExtractionOpInterface.

Definition at line 102 of file SubsetOpInterface.cpp.

References success(), and verifySubsetExtractionOpInterface().

Referenced by verifySubsetExtractionOpInterface().

◆ verifySubsetOpInterface()

LogicalResult mlir::detail::verifySubsetOpInterface ( SubsetOpInterface op)

Verify SubsetOpInterface.

Definition at line 92 of file SubsetOpInterface.cpp.

References success(), and verifySubsetOpInterface().

Referenced by verifySubsetOpInterface().

◆ verifySymbol()

◆ verifySymbolTable()

◆ verifyTargetSystemSpec()

LogicalResult mlir::detail::verifyTargetSystemSpec ( TargetSystemSpecInterface spec,
Location loc )

Verifies that a target system desc spec is valid.

This dispatches to individual entry verifiers, and then to the verifiers implemented by the relevant dialect interfaces for identifier keys.

Definition at line 887 of file DataLayoutInterfaces.cpp.

References mlir::emitError(), mlir::Dialect::getNamespace(), and success().

◆ verifyTypesAlongControlFlowEdges()

LogicalResult mlir::detail::verifyTypesAlongControlFlowEdges ( Operation * op)

Verify that types match along control flow edges described the given op.

Definition at line 221 of file ControlFlowInterfaces.cpp.

References mlir::Operation::getRegions(), mlir::OperandRange::getTypes(), mlir::RegionBranchPoint::parent(), success(), TypeRange, and verifyTypesAlongAllEdges().

◆ walk() [1/14]

template<typename Iterator>
void mlir::detail::walk ( Operation * op,
function_ref< void(Block *)> callback,
WalkOrder order )

Definition at line 119 of file Visitors.h.

References mlir::PostOrder, mlir::PreOrder, and walk().

◆ walk() [2/14]

template<typename Iterator>
void mlir::detail::walk ( Operation * op,
function_ref< void(Operation *)> callback,
WalkOrder order )

Definition at line 136 of file Visitors.h.

References mlir::PostOrder, mlir::PreOrder, and walk().

◆ walk() [3/14]

void mlir::detail::walk ( Operation * op,
function_ref< void(Operation *, const WalkStage &stage)> callback )

Generic walkers with stage aware callbacks.

Walk all the operations nested under (and including) the given operation, with the callback being invoked on each operation N+1 times, where N is the number of regions attached to the operation. The stage input to the callback indicates the current walk stage. This method is invoked for void returning callbacks.

◆ walk() [4/14]

template<typename Iterator>
void mlir::detail::walk ( Operation * op,
function_ref< void(Region *)> callback,
WalkOrder order )

Walk all of the regions, blocks, or operations nested under (and including) the given operation.

The order in which regions, blocks and operations at the same nesting level are visited (e.g., lexicographical or reverse lexicographical order) is determined by 'Iterator'. The walk order for enclosing regions, blocks and operations with respect to their nested ones is specified by 'order'. These methods are invoked for void-returning callbacks. A callback on a block or operation is allowed to erase that block or operation only if the walk is in post-order. See non-void method for pre-order erasure.

Definition at line 102 of file Visitors.h.

References mlir::PostOrder, mlir::PreOrder, and walk().

Referenced by mlir::Block::walk(), walk(), walk(), walk(), walk(), walk(), walk(), walk(), mlir::Operation::walk(), mlir::PatternApplicator::walkAllPatterns(), and walkImmediateSubElementsImpl().

◆ walk() [5/14]

template<typename Iterator>
WalkResult mlir::detail::walk ( Operation * op,
function_ref< WalkResult(Block *)> callback,
WalkOrder order )

◆ walk() [6/14]

template<typename Iterator>
WalkResult mlir::detail::walk ( Operation * op,
function_ref< WalkResult(Operation *)> callback,
WalkOrder order )

◆ walk() [7/14]

WalkResult mlir::detail::walk ( Operation * op,
function_ref< WalkResult(Operation *, const WalkStage &stage)> callback )

Walk all the operations nested under (and including) the given operation, with the callback being invoked on each operation N+1 times, where N is the number of regions attached to the operation.

The stage input to the callback indicates the current walk stage. This method is invoked for skippable or interruptible callbacks.

◆ walk() [8/14]

template<typename Iterator>
WalkResult mlir::detail::walk ( Operation * op,
function_ref< WalkResult(Region *)> callback,
WalkOrder order )

Walk all of the regions, blocks, or operations nested under (and including) the given operation.

The order in which regions, blocks and operations at the same nesting level are visited (e.g., lexicographical or reverse lexicographical order) is determined by 'Iterator'. The walk order for enclosing regions, blocks and operations with respect to their nested ones is specified by 'order'. This method is invoked for skippable or interruptible callbacks. A callback on a block or operation is allowed to erase that block or operation if either:

  • the walk is in post-order, or
  • the walk is in pre-order and the walk is skipped after the erasure.

Definition at line 166 of file Visitors.h.

References mlir::WalkResult::advance(), mlir::WalkResult::interrupt(), mlir::PostOrder, mlir::PreOrder, result, and walk().

◆ walk() [9/14]

template<WalkOrder Order = WalkOrder::PostOrder, typename Iterator = ForwardIterator, typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()(std::declval<ArgT>()))>
std::enable_if_t< llvm::is_one_of< ArgT, Operation *, Region *, Block * >::value, RetT > mlir::detail::walk ( Operation * op,
FuncTy && callback )

Walk all of the regions, blocks, or operations nested under (and including) the given operation.

The order in which regions, blocks and operations at the same nesting level are visited (e.g., lexicographical or reverse lexicographical order) is determined by 'Iterator'. The walk order for enclosing regions, blocks and operations with respect to their nested ones is specified by 'Order' (post-order by default). A callback on a block or operation is allowed to erase that block or operation if either:

  • the walk is in post-order, or
  • the walk is in pre-order and the walk is skipped after the erasure. This method is selected for callbacks that operate on Region*, Block*, and Operation*.

Example: op->walk([](Region *r) { ... }); op->walk([](Block *b) { ... }); op->walk([](Operation *op) { ... });

Definition at line 277 of file Visitors.h.

References walk().

◆ walk() [10/14]

template<WalkOrder Order = WalkOrder::PostOrder, typename Iterator = ForwardIterator, typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()(std::declval<ArgT>()))>
std::enable_if_t< !llvm::is_one_of< ArgT, Operation *, Region *, Block * >::value &&std::is_same< RetT, void >::value, RetT > mlir::detail::walk ( Operation * op,
FuncTy && callback )

Walk all of the operations of type 'ArgT' nested under and including the given operation.

The order in which regions, blocks and operations at the same nesting are visited (e.g., lexicographical or reverse lexicographical order) is determined by 'Iterator'. The walk order for enclosing regions, blocks and operations with respect to their nested ones is specified by 'order' (post-order by default). This method is selected for void-returning callbacks that operate on a specific derived operation type. A callback on an operation is allowed to erase that operation only if the walk is in post-order. See non-void method for pre-order erasure.

Example: op->walk([](ReturnOp op) { ... });

Definition at line 301 of file Visitors.h.

References walk().

◆ walk() [11/14]

template<WalkOrder Order = WalkOrder::PostOrder, typename Iterator = ForwardIterator, typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()(std::declval<ArgT>()))>
std::enable_if_t< !llvm::is_one_of< ArgT, Operation *, Region *, Block * >::value &&std::is_same< RetT, WalkResult >::value, RetT > mlir::detail::walk ( Operation * op,
FuncTy && callback )

Walk all of the operations of type 'ArgT' nested under and including the given operation.

The order in which regions, blocks and operations at the same nesting are visited (e.g., lexicographical or reverse lexicographical order) is determined by 'Iterator'. The walk order for enclosing regions, blocks and operations with respect to their nested ones is specified by 'Order' (post-order by default). This method is selected for WalkReturn returning skippable or interruptible callbacks that operate on a specific derived operation type. A callback on an operation is allowed to erase that operation if either:

  • the walk is in post-order, or
  • the walk is in pre-order and the walk is skipped after the erasure.

Example: op->walk([](ReturnOp op) { if (some_invariant) return WalkResult::skip(); if (another_invariant) return WalkResult::interrupt(); return WalkResult::advance(); });

Definition at line 338 of file Visitors.h.

References mlir::WalkResult::advance(), and walk().

◆ walk() [12/14]

template<typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()( std::declval<ArgT>(), std::declval<const WalkStage &>()))>
std::enable_if_t< std::is_same< ArgT, Operation * >::value, RetT > mlir::detail::walk ( Operation * op,
FuncTy && callback )

Walk all of the operations nested under and including the given operation.

This method is selected for stage-aware callbacks that operate on Operation*.

Example: op->walk([](Operation *op, const WalkStage &stage) { ... });

Definition at line 377 of file Visitors.h.

References walk().

◆ walk() [13/14]

template<typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()( std::declval<ArgT>(), std::declval<const WalkStage &>()))>
std::enable_if_t<!std::is_same< ArgT, Operation * >::value &&std::is_same< RetT, void >::value, RetT > mlir::detail::walk ( Operation * op,
FuncTy && callback )

Walk all of the operations of type 'ArgT' nested under and including the given operation.

This method is selected for void returning callbacks that operate on a specific derived operation type.

Example: op->walk([](ReturnOp op, const WalkStage &stage) { ... });

Definition at line 394 of file Visitors.h.

References walk().

◆ walk() [14/14]

template<typename FuncTy, typename ArgT = detail::first_argument<FuncTy>, typename RetT = decltype(std::declval<FuncTy>()( std::declval<ArgT>(), std::declval<const WalkStage &>()))>
std::enable_if_t<!std::is_same< ArgT, Operation * >::value &&std::is_same< RetT, WalkResult >::value, RetT > mlir::detail::walk ( Operation * op,
FuncTy && callback )

Walk all of the operations of type 'ArgT' nested under and including the given operation.

This method is selected for WalkReturn returning interruptible callbacks that operate on a specific derived operation type.

Example: op->walk(op, [](ReturnOp op, const WalkStage &stage) { if (some_invariant) return WalkResult::interrupt(); return WalkResult::advance(); });

Definition at line 419 of file Visitors.h.

References mlir::WalkResult::advance(), and walk().

◆ walkImmediateSubElementsImpl()

template<typename T>
void mlir::detail::walkImmediateSubElementsImpl ( T derived,
function_ref< void(Attribute)> walkAttrsFn,
function_ref< void(Type)> walkTypesFn )

This function provides the underlying implementation for the SubElementInterface walk method, using the key type of the derived attribute/type to interact with the individual parameters.

Definition at line 518 of file AttrTypeSubElements.h.

References mlir::has_sub_attr_or_type_v, and walk().

Referenced by mlir::detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::AttributeUniquer, Traits... >::getWalkImmediateSubElementsFn().

◆ wrapIntegerMemorySpace()

Attribute mlir::detail::wrapIntegerMemorySpace ( unsigned memorySpace,
MLIRContext * ctx )

Wraps deprecated integer memory space to the new Attribute form.

Definition at line 538 of file BuiltinTypes.cpp.