MLIR  16.0.0git
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:
+ Collaboration diagram for mlir::DataLayoutSpecAttr:

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...
 
void print (AsmPrinter &os) const
 Prints this attribute. 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...
 
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...
 

Additional Inherited Members

- 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)
 
- 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...
 
ImplTypegetImpl () const
 Utility for easy access to the 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 67 of file DLTI.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 246 of file DLTI.cpp.

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

◆ get()

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

Returns the specification containing the given list of keys.

Definition at line 133 of file DLTI.cpp.

Referenced by combineWith().

◆ 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 139 of file DLTI.cpp.

References mlir::emitError().

◆ getEntries()

DataLayoutEntryListRef DataLayoutSpecAttr::getEntries ( ) const

Returns the list of entries.

Definition at line 272 of file DLTI.cpp.

◆ 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 280 of file DLTI.cpp.

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

Referenced by print().

◆ print()

void DataLayoutSpecAttr::print ( AsmPrinter os) const

◆ 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 146 of file DLTI.cpp.

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

Member Data Documentation

◆ kAttrKeyword

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

The keyword used for this attribute in custom syntax.

Definition at line 75 of file DLTI.h.

Referenced by mlir::DataLayoutEntryAttr::print(), and print().


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