MLIR  16.0.0git
Functions
DataLayoutInterfaces.cpp File Reference
#include "mlir/Interfaces/DataLayoutInterfaces.h"
#include "mlir/IR/BuiltinDialect.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Operation.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/MathExtras.h"
#include "mlir/Interfaces/DataLayoutAttrInterface.cpp.inc"
#include "mlir/Interfaces/DataLayoutOpInterface.cpp.inc"
#include "mlir/Interfaces/DataLayoutTypeInterface.cpp.inc"
+ Include dependency graph for DataLayoutInterfaces.cpp:

Go to the source code of this file.

Functions

static void reportMissingDataLayout (Type type)
 Reports that the given type is missing the data layout information and exits. More...
 
static unsigned getIndexBitwidth (DataLayoutEntryListRef params)
 Returns the bitwidth of the index type if specified in the param list. More...
 
static DataLayoutEntryInterface findEntryForIntegerType (IntegerType intType, ArrayRef< DataLayoutEntryInterface > params)
 
static unsigned extractABIAlignment (DataLayoutEntryInterface entry)
 
static unsigned getIntegerTypeABIAlignment (IntegerType intType, ArrayRef< DataLayoutEntryInterface > params)
 
static unsigned getFloatTypeABIAlignment (FloatType fltType, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
 
static unsigned extractPreferredAlignment (DataLayoutEntryInterface entry)
 
static unsigned getIntegerTypePreferredAlignment (IntegerType intType, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
 
static unsigned getFloatTypePreferredAlignment (FloatType fltType, const DataLayout &dataLayout, ArrayRef< DataLayoutEntryInterface > params)
 
static DataLayoutSpecInterface getSpec (Operation *operation)
 
static void collectParentLayouts (Operation *leaf, SmallVectorImpl< DataLayoutSpecInterface > &specs, SmallVectorImpl< Location > *opLocations=nullptr)
 Populates opsWithLayout with the list of proper ancestors of leaf that are either modules or implement the DataLayoutOpInterface. More...
 
static DataLayoutSpecInterface getCombinedDataLayout (Operation *leaf)
 Returns a layout spec that is a combination of the layout specs attached to the given operation and all its ancestors. More...
 
template<typename OpTy >
void checkMissingLayout (DataLayoutSpecInterface originalLayout, OpTy op)
 
static unsigned cachedLookup (Type t, DenseMap< Type, unsigned > &cache, function_ref< unsigned(Type)> compute)
 Looks up the value for the given type key in the given cache. More...
 

Function Documentation

◆ cachedLookup()

static unsigned cachedLookup ( Type  t,
DenseMap< Type, unsigned > &  cache,
function_ref< unsigned(Type)>  compute 
)
static

Looks up the value for the given type key in the given cache.

If there is no such value in the cache, compute it using the given callback and put it in the cache before returning.

Definition at line 401 of file DataLayoutInterfaces.cpp.

Referenced by mlir::DataLayout::getTypeABIAlignment(), mlir::DataLayout::getTypePreferredAlignment(), mlir::DataLayout::getTypeSize(), and mlir::DataLayout::getTypeSizeInBits().

◆ checkMissingLayout()

template<typename OpTy >
void checkMissingLayout ( DataLayoutSpecInterface  originalLayout,
OpTy  op 
)

Definition at line 338 of file DataLayoutInterfaces.cpp.

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

◆ collectParentLayouts()

static void collectParentLayouts ( Operation leaf,
SmallVectorImpl< DataLayoutSpecInterface > &  specs,
SmallVectorImpl< Location > *  opLocations = nullptr 
)
static

Populates opsWithLayout with the list of proper ancestors of leaf that are either modules or implement the DataLayoutOpInterface.

Definition at line 250 of file DataLayoutInterfaces.cpp.

References mlir::Operation::getParentOp().

Referenced by mlir::DataLayout::closest(), mlir::DataLayout::DataLayout(), getCombinedDataLayout(), and mlir::detail::verifyDataLayoutOp().

◆ extractABIAlignment()

static unsigned extractABIAlignment ( DataLayoutEntryInterface  entry)
static

◆ extractPreferredAlignment()

static unsigned extractPreferredAlignment ( DataLayoutEntryInterface  entry)
static

◆ findEntryForIntegerType()

static DataLayoutEntryInterface findEntryForIntegerType ( IntegerType  intType,
ArrayRef< DataLayoutEntryInterface >  params 
)
static

◆ getCombinedDataLayout()

static DataLayoutSpecInterface getCombinedDataLayout ( Operation leaf)
static

Returns a layout spec that is a combination of the layout specs attached to the given operation and all its ancestors.

Definition at line 281 of file DataLayoutInterfaces.cpp.

References collectParentLayouts(), and getSpec().

Referenced by mlir::DataLayout::closest(), and mlir::detail::verifyDataLayoutOp().

◆ getFloatTypeABIAlignment()

static unsigned getFloatTypeABIAlignment ( FloatType  fltType,
const DataLayout dataLayout,
ArrayRef< DataLayoutEntryInterface >  params 
)
static

◆ getFloatTypePreferredAlignment()

static unsigned getFloatTypePreferredAlignment ( FloatType  fltType,
const DataLayout dataLayout,
ArrayRef< DataLayoutEntryInterface >  params 
)
static

◆ getIndexBitwidth()

static unsigned getIndexBitwidth ( DataLayoutEntryListRef  params)
static

Returns the bitwidth of the index type if specified in the param list.

Assumes 64-bit index otherwise.

Definition at line 37 of file DataLayoutInterfaces.cpp.

Referenced by mlir::detail::getDefaultABIAlignment(), mlir::detail::getDefaultPreferredAlignment(), and mlir::detail::getDefaultTypeSizeInBits().

◆ getIntegerTypeABIAlignment()

static unsigned getIntegerTypeABIAlignment ( IntegerType  intType,
ArrayRef< DataLayoutEntryInterface >  params 
)
static

◆ getIntegerTypePreferredAlignment()

static unsigned getIntegerTypePreferredAlignment ( IntegerType  intType,
const DataLayout dataLayout,
ArrayRef< DataLayoutEntryInterface >  params 
)
static

◆ getSpec()

static DataLayoutSpecInterface getSpec ( Operation operation)
static

◆ reportMissingDataLayout()

static void reportMissingDataLayout ( Type  type)
static

Reports that the given type is missing the data layout information and exits.

Definition at line 26 of file DataLayoutInterfaces.cpp.

Referenced by mlir::detail::getDefaultABIAlignment(), mlir::detail::getDefaultPreferredAlignment(), and mlir::detail::getDefaultTypeSizeInBits().