|
MLIR 23.0.0git
|
#include "mlir/IR/BuiltinAttributes.h"#include "AttributeDetail.h"#include "mlir/IR/AffineMap.h"#include "mlir/IR/BuiltinDialect.h"#include "mlir/IR/Dialect.h"#include "mlir/IR/DialectResourceBlobManager.h"#include "mlir/IR/IntegerSet.h"#include "mlir/IR/OpImplementation.h"#include "mlir/IR/Operation.h"#include "mlir/IR/SymbolTable.h"#include "mlir/IR/Types.h"#include "llvm/ADT/APSInt.h"#include "llvm/Support/Debug.h"#include "llvm/Support/DebugLog.h"#include "llvm/Support/Endian.h"#include <optional>#include "mlir/IR/BuiltinAttributes.cpp.inc"Go to the source code of this file.
Namespaces | |
| namespace | mlir |
| Include the generated interface declarations. | |
| namespace | mlir::detail |
| AttrTypeReplacer. | |
Macros | |
| #define | DEBUG_TYPE "builtinattributes" |
| #define | GET_ATTRDEF_CLASSES |
| Tablegen Attribute Definitions. | |
| #define | GET_ATTRDEF_LIST |
Functions | |
| template<bool inPlace> | |
| static bool | dictionaryAttrSort (ArrayRef< NamedAttribute > value, SmallVectorImpl< NamedAttribute > &storage) |
| Helper function that does either an in place sort or sorts from source array into destination. | |
| static std::optional< NamedAttribute > | findDuplicateElement (ArrayRef< NamedAttribute > value) |
| Returns an entry with a duplicate name from the given sorted array of named attributes. | |
| static size_t | getDenseElementStorageWidth (size_t origWidth) |
| Get the bitwidth of a dense element type within the buffer. | |
| static size_t | getDenseElementStorageWidth (Type elementType) |
| static void | copyAPIntToArrayForBEmachine (APInt value, size_t numBytes, char *result) |
| Copy actual numBytes data from value (APInt) to char array(result) for BE format. | |
| static void | copyArrayToAPIntForBEmachine (const char *inArray, size_t numBytes, APInt &result) |
| Copy numBytes data from inArray(char array) to result(APINT) for BE format. | |
| static void | writeBits (char *rawData, size_t bitPos, APInt value) |
| Writes value to the bit position bitPos in array rawData. | |
| static APInt | readBits (const char *rawData, size_t bitPos, size_t bitWidth) |
| Reads the next bitWidth bits from the bit position bitPos in array rawData. | |
| template<typename Values> | |
| static bool | hasSameNumElementsOrSplat (ShapedType type, const Values &values) |
| Returns true if 'values' corresponds to a splat, i.e. | |
| static bool | isValidIntOrFloat (Type type, int64_t dataEltSize, bool isInt, bool isSigned) |
| Check the information for a C++ data type, check if this type is valid for the current attribute. | |
| static bool | isComplexOfIntType (Type type) |
| Return if the given complex type has an integer element type. | |
| template<typename APRangeT> | |
| static void | writeAPIntsToBuffer (size_t storageWidth, SmallVectorImpl< char > &data, APRangeT &&values) |
| Utility method to write a range of APInt values to a buffer. | |
| template<typename Fn, typename Attr> | |
| static ShapedType | mappingHelper (Fn mapping, Attr &attr, ShapedType inType, Type newElementType, llvm::SmallVectorImpl< char > &data) |
| #define DEBUG_TYPE "builtinattributes" |
Definition at line 26 of file BuiltinAttributes.cpp.
| #define GET_ATTRDEF_CLASSES |
Tablegen Attribute Definitions.
Definition at line 35 of file BuiltinAttributes.cpp.
| #define GET_ATTRDEF_LIST |
|
static |
Copy actual numBytes data from value (APInt) to char array(result) for BE format.
Definition at line 467 of file BuiltinAttributes.cpp.
References result.
Referenced by writeBits().
|
static |
Copy numBytes data from inArray(char array) to result(APINT) for BE format.
Definition at line 496 of file BuiltinAttributes.cpp.
References result.
Referenced by readBits().
|
static |
Helper function that does either an in place sort or sorts from source array into destination.
If inPlace then storage is both the source and the destination, else value is the source and storage destination. Returns whether source was sorted.
Definition at line 59 of file BuiltinAttributes.cpp.
|
static |
Returns an entry with a duplicate name from the given sorted array of named attributes.
Returns std::nullopt if all elements have unique names.
Definition at line 101 of file BuiltinAttributes.cpp.
|
static |
Get the bitwidth of a dense element type within the buffer.
DenseElementsAttr requires bitwidths to be aligned by 8.
Definition at line 458 of file BuiltinAttributes.cpp.
Referenced by mlir::DenseElementsAttr::get(), mlir::DenseElementsAttr::get(), mlir::DenseElementsAttr::get(), mlir::DenseElementsAttr::get(), mlir::DenseElementsAttr::get(), getDenseElementStorageWidth(), mlir::DenseElementsAttr::isValidRawBuffer(), mappingHelper(), mlir::DenseElementsAttr::ComplexIntElementIterator::operator*(), and mlir::DenseElementsAttr::IntElementIterator::operator*().
|
static |
Definition at line 461 of file BuiltinAttributes.cpp.
References mlir::detail::getDenseElementBitWidth(), and getDenseElementStorageWidth().
|
static |
Returns true if 'values' corresponds to a splat, i.e.
one element, or has the same element count as 'type'.
Definition at line 576 of file BuiltinAttributes.cpp.
Referenced by mlir::DenseElementsAttr::get(), mlir::DenseElementsAttr::get(), mlir::DenseElementsAttr::get(), mlir::DenseElementsAttr::get(), mlir::DenseElementsAttr::get(), and mlir::DenseElementsAttr::get().
Return if the given complex type has an integer element type.
Definition at line 1127 of file BuiltinAttributes.cpp.
References getElementType().
Referenced by mlir::DenseElementsAttr::tryGetComplexIntValues().
Check the information for a C++ data type, check if this type is valid for the current attribute.
This method is used to verify specific type invariants that the templatized 'getValues' method cannot.
Definition at line 1049 of file BuiltinAttributes.cpp.
References mlir::detail::getDenseElementBitWidth(), and mlir::Type::isIndex().
|
static |
Definition at line 1394 of file BuiltinAttributes.cpp.
References mlir::detail::getDenseElementBitWidth(), getDenseElementStorageWidth(), and writeBits().
Referenced by mlir::DenseFPElementsAttr::mapValues(), and mlir::DenseIntElementsAttr::mapValues().
|
static |
Reads the next bitWidth bits from the bit position bitPos in array rawData.
Definition at line 552 of file BuiltinAttributes.cpp.
References copyArrayToAPIntForBEmachine(), and result.
Referenced by mlir::DenseElementsAttr::ComplexIntElementIterator::operator*(), and mlir::DenseElementsAttr::IntElementIterator::operator*().
|
static |
Utility method to write a range of APInt values to a buffer.
Definition at line 1249 of file BuiltinAttributes.cpp.
References writeBits().
|
static |
Writes value to the bit position bitPos in array rawData.
Definition at line 530 of file BuiltinAttributes.cpp.
References copyAPIntToArrayForBEmachine().
Referenced by mlir::DenseElementsAttr::get(), mappingHelper(), and writeAPIntsToBuffer().