MLIR  16.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
mlir::AbstractAttribute Class Reference

This class contains all of the static information common to all instances of a registered Attribute. More...

#include "mlir/IR/AttributeSupport.h"

Public Types

using HasTraitFn = llvm::unique_function< bool(TypeID) const >
 

Public Member Functions

DialectgetDialect () const
 Return the dialect this attribute was registered to. More...
 
template<typename T >
T::Concept * getInterface () const
 Returns an instance of the concept object for the given interface if it was registered to this attribute, null otherwise. More...
 
bool hasInterface (TypeID interfaceID) const
 Returns true if the attribute has the interface with the given ID registered. More...
 
template<template< typename T > class Trait>
bool hasTrait () const
 Returns true if the attribute has a particular trait. More...
 
bool hasTrait (TypeID traitID) const
 Returns true if the attribute has a particular trait. More...
 
TypeID getTypeID () const
 Return the unique identifier representing the concrete attribute class. More...
 

Static Public Member Functions

static const AbstractAttributelookup (TypeID typeID, MLIRContext *context)
 Look up the specified abstract attribute in the MLIRContext and return a reference to it. More...
 
template<typename T >
static AbstractAttribute get (Dialect &dialect)
 This method is used by Dialect objects when they register the list of attributes they contain. More...
 
static AbstractAttribute get (Dialect &dialect, detail::InterfaceMap &&interfaceMap, HasTraitFn &&hasTrait, TypeID typeID)
 This method is used by Dialect objects to register attributes with custom TypeIDs. More...
 

Friends

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
class detail::StorageUserBase
 Give StorageUserBase access to the mutable lookup. More...
 

Detailed Description

This class contains all of the static information common to all instances of a registered Attribute.

Definition at line 32 of file AttributeSupport.h.

Member Typedef Documentation

◆ HasTraitFn

using mlir::AbstractAttribute::HasTraitFn = llvm::unique_function<bool(TypeID) const>

Definition at line 34 of file AttributeSupport.h.

Member Function Documentation

◆ get() [1/2]

template<typename T >
static AbstractAttribute mlir::AbstractAttribute::get ( Dialect dialect)
inlinestatic

This method is used by Dialect objects when they register the list of attributes they contain.

Definition at line 43 of file AttributeSupport.h.

Referenced by mlir::ExtensibleDialect::registerDynamicAttr().

◆ get() [2/2]

static AbstractAttribute mlir::AbstractAttribute::get ( Dialect dialect,
detail::InterfaceMap &&  interfaceMap,
HasTraitFn &&  hasTrait,
TypeID  typeID 
)
inlinestatic

This method is used by Dialect objects to register attributes with custom TypeIDs.

The use of this method is in general discouraged in favor of 'get<CustomAttribute>(dialect)'.

Definition at line 52 of file AttributeSupport.h.

◆ getDialect()

Dialect& mlir::AbstractAttribute::getDialect ( ) const
inline

Return the dialect this attribute was registered to.

Definition at line 60 of file AttributeSupport.h.

◆ getInterface()

template<typename T >
T::Concept* mlir::AbstractAttribute::getInterface ( ) const
inline

Returns an instance of the concept object for the given interface if it was registered to this attribute, null otherwise.

This should not be used directly.

Definition at line 66 of file AttributeSupport.h.

◆ getTypeID()

TypeID mlir::AbstractAttribute::getTypeID ( ) const
inline

Return the unique identifier representing the concrete attribute class.

Definition at line 86 of file AttributeSupport.h.

◆ hasInterface()

bool mlir::AbstractAttribute::hasInterface ( TypeID  interfaceID) const
inline

Returns true if the attribute has the interface with the given ID registered.

Definition at line 72 of file AttributeSupport.h.

◆ hasTrait() [1/2]

template<template< typename T > class Trait>
bool mlir::AbstractAttribute::hasTrait ( ) const
inline

Returns true if the attribute has a particular trait.

Definition at line 78 of file AttributeSupport.h.

Referenced by mlir::Attribute::hasTrait().

◆ hasTrait() [2/2]

bool mlir::AbstractAttribute::hasTrait ( TypeID  traitID) const
inline

Returns true if the attribute has a particular trait.

Definition at line 83 of file AttributeSupport.h.

◆ lookup()

const AbstractAttribute & AbstractAttribute::lookup ( TypeID  typeID,
MLIRContext context 
)
static

Look up the specified abstract attribute in the MLIRContext and return a reference to it.

Get the dialect that registered the attribute with the provided typeid.

Definition at line 631 of file MLIRContext.cpp.

References mlir::MLIRContext::getImpl().

Referenced by mlir::MLIRContext::getAttributeUniquer().

Friends And Related Function Documentation

◆ detail::StorageUserBase

template<typename ConcreteT , typename BaseT , typename StorageT , typename UniquerT , template< typename T > class... Traits>
friend class detail::StorageUserBase
friend

Give StorageUserBase access to the mutable lookup.

Definition at line 97 of file AttributeSupport.h.


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