MLIR  19.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
mlir::DataLayoutSpecAttr Class Reference

A data layout specification is a list of entries that specify (partial) data layout information. More...

#include "mlir/Dialect/DLTI/DLTI.h"

+ Inheritance diagram for mlir::DataLayoutSpecAttr:

Public Types

using Base = StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits... >
 Utility declarations for the concrete attribute class. More...
 
- Public Types inherited from mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >
using Base = StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits... >
 Utility declarations for the concrete attribute class. More...
 
using ImplType = StorageT
 
using HasTraitFn = bool(*)(TypeID)
 

Public Member Functions

DataLayoutSpecAttr combineWith (ArrayRef< DataLayoutSpecInterface > specs) const
 Combines this specification with specs, enclosing specifications listed from outermost to innermost. More...
 
DataLayoutEntryListRef getEntries () const
 Returns the list of entries. More...
 
StringAttr getAllocaMemorySpaceIdentifier (MLIRContext *context) const
 Returns the alloca memory space identifier. More...
 
StringAttr getProgramMemorySpaceIdentifier (MLIRContext *context) const
 Returns the program memory space identifier. More...
 
StringAttr getGlobalMemorySpaceIdentifier (MLIRContext *context) const
 Returns the global memory space identifier. More...
 
StringAttr getStackAlignmentIdentifier (MLIRContext *context) const
 Returns the stack alignment identifier. More...
 
void print (AsmPrinter &os) const
 Prints this attribute. More...
 
- Public Member Functions inherited from mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >
ImplTypegetImpl () const
 Utility for easy access to the storage instance. More...
 

Static Public Member Functions

static DataLayoutSpecAttr get (MLIRContext *ctx, ArrayRef< DataLayoutEntryInterface > entries)
 Returns the specification containing the given list of keys. More...
 
static DataLayoutSpecAttr getChecked (function_ref< InFlightDiagnostic()> emitError, MLIRContext *context, ArrayRef< DataLayoutEntryInterface > entries)
 Returns the specification containing the given list of keys. More...
 
static LogicalResult verify (function_ref< InFlightDiagnostic()> emitError, ArrayRef< DataLayoutEntryInterface > entries)
 Checks that the given list of entries does not contain duplicate keys. More...
 
static DataLayoutSpecAttr parse (AsmParser &parser)
 Parses an instance of this attribute. More...
 
- Static Public Member Functions inherited from mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >
static TypeID getTypeID ()
 Return a unique identifier for the concrete type. More...
 
template<typename T >
static bool classof (T val)
 Provide an implementation of 'classof' that compares the type id of the provided value with that of the concrete type. More...
 
static detail::InterfaceMap getInterfaceMap ()
 Returns an interface map for the interfaces registered to this storage user. More...
 
static HasTraitFn getHasTraitFn ()
 Returns the function that returns true if the given Trait ID matches the IDs of any of the traits defined by the storage user. More...
 
static auto getWalkImmediateSubElementsFn ()
 Returns a function that walks immediate sub elements of a given instance of the storage user. More...
 
static auto getReplaceImmediateSubElementsFn ()
 Returns a function that replaces immediate sub elements of a given instance of the storage user. More...
 
template<typename... IfaceModels>
static void attachInterface (MLIRContext &context)
 Attach the given models as implementations of the corresponding interfaces for the concrete storage user class. More...
 
template<typename... Args>
static ConcreteT get (MLIRContext *ctx, Args &&...args)
 Get or create a new ConcreteT instance within the ctx. More...
 
template<typename... Args>
static ConcreteT getChecked (const Location &loc, Args &&...args)
 Get or create a new ConcreteT instance within the ctx, defined at the given, potentially unknown, location. More...
 
template<typename... Args>
static ConcreteT getChecked (function_ref< InFlightDiagnostic()> emitErrorFn, MLIRContext *ctx, Args... args)
 Get or create a new ConcreteT instance within the ctx. More...
 
static ConcreteT getFromOpaquePointer (const void *ptr)
 Get an instance of the concrete type from a void pointer. More...
 

Static Public Attributes

constexpr static const StringLiteral kAttrKeyword = "dl_spec"
 The keyword used for this attribute in custom syntax. More...
 
static constexpr StringLiteral name = "builtin.data_layout_spec"
 

Additional Inherited Members

- Protected Member Functions inherited from mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >
template<typename... Args>
LogicalResult mutate (Args &&...args)
 Mutate the current storage instance. More...
 
- Static Protected Member Functions inherited from mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >
template<typename... Args>
static LogicalResult verify (Args... args)
 Default implementation that just returns success. More...
 

Detailed Description

A data layout specification is a list of entries that specify (partial) data layout information.

It is expected to be attached to operations that serve as scopes for data layout requests.

Definition at line 69 of file DLTI.h.

Member Typedef Documentation

◆ Base

using mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::Base = StorageUserBase<ConcreteT, BaseT, StorageT, UniquerT, Traits...>

Utility declarations for the concrete attribute class.

Definition at line 101 of file StorageUniquerSupport.h.

Member Function Documentation

◆ combineWith()

DataLayoutSpecAttr DataLayoutSpecAttr::combineWith ( ArrayRef< DataLayoutSpecInterface >  specs) const

Combines this specification with specs, enclosing specifications listed from outermost to innermost.

This overwrites the older entries with the same key as the newer entries if the entries are compatible. Returns null if the specifications are not compatible.

Definition at line 254 of file DLTI.cpp.

References combineOneSpec(), mlir::failed(), get(), and getContext().

◆ get()

DataLayoutSpecAttr DataLayoutSpecAttr::get ( MLIRContext ctx,
ArrayRef< DataLayoutEntryInterface >  entries 
)
static

Returns the specification containing the given list of keys.

Definition at line 141 of file DLTI.cpp.

References mlir::get().

Referenced by combineWith(), and parse().

◆ getAllocaMemorySpaceIdentifier()

StringAttr DataLayoutSpecAttr::getAllocaMemorySpaceIdentifier ( MLIRContext context) const

Returns the alloca memory space identifier.

Definition at line 285 of file DLTI.cpp.

References mlir::Builder::getStringAttr().

◆ getChecked()

DataLayoutSpecAttr DataLayoutSpecAttr::getChecked ( function_ref< InFlightDiagnostic()>  emitError,
MLIRContext context,
ArrayRef< DataLayoutEntryInterface >  entries 
)
static

Returns the specification containing the given list of keys.

If the list contains duplicate keys or is otherwise invalid, reports errors using the given callback and returns null.

Definition at line 147 of file DLTI.cpp.

References mlir::emitError().

Referenced by parse().

◆ getEntries()

DataLayoutEntryListRef DataLayoutSpecAttr::getEntries ( ) const

Returns the list of entries.

Definition at line 280 of file DLTI.cpp.

References mlir::detail::StorageUserBase< ConcreteT, BaseT, StorageT, UniquerT, Traits >::getImpl().

Referenced by print().

◆ getGlobalMemorySpaceIdentifier()

StringAttr DataLayoutSpecAttr::getGlobalMemorySpaceIdentifier ( MLIRContext context) const

Returns the global memory space identifier.

Definition at line 297 of file DLTI.cpp.

References mlir::Builder::getStringAttr().

◆ getProgramMemorySpaceIdentifier()

StringAttr DataLayoutSpecAttr::getProgramMemorySpaceIdentifier ( MLIRContext context) const

Returns the program memory space identifier.

Definition at line 290 of file DLTI.cpp.

References mlir::Builder::getStringAttr().

◆ getStackAlignmentIdentifier()

StringAttr DataLayoutSpecAttr::getStackAlignmentIdentifier ( MLIRContext context) const

Returns the stack alignment identifier.

Definition at line 302 of file DLTI.cpp.

References mlir::Builder::getStringAttr().

◆ parse()

DataLayoutSpecAttr DataLayoutSpecAttr::parse ( AsmParser parser)
static

Parses an instance of this attribute.

Parses an attribute with syntax attr ::= #target.

dl_spec < attr-list? > attr-list ::= attr | attr , attr-list

Definition at line 311 of file DLTI.cpp.

References mlir::AsmParser::emitError(), mlir::failed(), get(), getChecked(), mlir::AsmParser::getContext(), mlir::AsmParser::getNameLoc(), mlir::AsmParser::parseCommaSeparatedList(), mlir::AsmParser::parseGreater(), mlir::AsmParser::parseLess(), mlir::AsmParser::parseOptionalGreater(), and mlir::succeeded().

◆ print()

void DataLayoutSpecAttr::print ( AsmPrinter os) const

Prints this attribute.

Definition at line 329 of file DLTI.cpp.

References getEntries(), and kAttrKeyword.

◆ verify()

LogicalResult DataLayoutSpecAttr::verify ( function_ref< InFlightDiagnostic()>  emitError,
ArrayRef< DataLayoutEntryInterface >  entries 
)
static

Checks that the given list of entries does not contain duplicate keys.

Definition at line 154 of file DLTI.cpp.

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

Member Data Documentation

◆ kAttrKeyword

constexpr const StringLiteral mlir::DataLayoutSpecAttr::kAttrKeyword = "dl_spec"
staticconstexpr

The keyword used for this attribute in custom syntax.

Definition at line 77 of file DLTI.h.

Referenced by print().

◆ name

constexpr StringLiteral mlir::DataLayoutSpecAttr::name = "builtin.data_layout_spec"
staticconstexpr

Definition at line 121 of file DLTI.h.


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