|
clang 24.0.0git
|
#include "mlir/IR/BuiltinAttributes.h"#include "mlir/Interfaces/DataLayoutInterfaces.h"#include "mlir/Transforms/DialectConversion.h"#include "clang/CIR/Dialect/IR/CIRDialect.h"Go to the source code of this file.
Functions | |
| mlir::DenseElementsAttr | convertStringAttrToDenseElementsAttr (cir::ConstArrayAttr attr, mlir::Type type) |
| template<typename StorageTy> | |
| StorageTy | getZeroInitFromType (mlir::Type ty) |
| template<> | |
| mlir::APInt | getZeroInitFromType (mlir::Type ty) |
| template<> | |
| mlir::APFloat | getZeroInitFromType (mlir::Type ty) |
| template<typename AttrTy, typename StorageTy> | |
| void | convertToDenseElementsAttrImpl (cir::ConstArrayAttr attr, llvm::SmallVectorImpl< StorageTy > &values) |
| template<typename AttrTy, typename StorageTy> | |
| mlir::DenseElementsAttr | convertToDenseElementsAttr (cir::ConstArrayAttr attr, const llvm::SmallVectorImpl< int64_t > &dims, mlir::Type type) |
| std::optional< mlir::Attribute > | lowerConstArrayAttr (cir::ConstArrayAttr constArr, mlir::SymbolTableCollection &symbolTables, const mlir::TypeConverter *converter, mlir::ModuleOp moduleOp={}) |
| std::optional< mlir::Attribute > | lowerConstRecordAttr (cir::ConstRecordAttr constRecord, mlir::SymbolTableCollection &symbolTables, const mlir::TypeConverter *converter, mlir::ModuleOp moduleOp={}) |
| mlir::Attribute | spellOutSplitTrailingZeros (mlir::Attribute attr) |
Return attr with the trailing zeros of any array that adjustGlobalTypeForInit would split off written out as explicit zero elements, so that it lowers to its own type. | |
| mlir::Type | adjustGlobalTypeForInit (mlir::Type llvmType, mlir::Attribute init, const mlir::TypeConverter &converter, const mlir::DataLayout &dataLayout) |
Adjust llvmType (the converted type of init) to the concrete LLVM type a global constant initialized with init actually lowers to. | |
| mlir::Type | adjustGlobalTypeForInit (mlir::Type llvmType, mlir::Attribute init, const mlir::TypeConverter &converter, const mlir::DataLayout &dataLayout, llvm::SmallVectorImpl< unsigned > &paddingAddedIndexes) |
| mlir::Value | getConstAPInt (mlir::OpBuilder &bld, mlir::Location loc, mlir::Type typ, const llvm::APInt &val) |
| mlir::Value | getConst (mlir::OpBuilder &bld, mlir::Location loc, mlir::Type typ, unsigned val) |
| mlir::Value | createShL (mlir::OpBuilder &bld, mlir::Value lhs, unsigned rhs) |
| mlir::Value | createAShR (mlir::OpBuilder &bld, mlir::Value lhs, unsigned rhs) |
| mlir::Value | createAnd (mlir::OpBuilder &bld, mlir::Value lhs, const llvm::APInt &rhs) |
| mlir::Value | createLShR (mlir::OpBuilder &bld, mlir::Value lhs, unsigned rhs) |
| mlir::Type | convertTypeForMemory (const mlir::TypeConverter &converter, mlir::DataLayout const &dataLayout, mlir::Type type, bool isForHLSL=false) |
| mlir::Type | convertTypeForLoadStore (const mlir::TypeConverter &converter, mlir::DataLayout const &dataLayout, mlir::Type type) |
| The type of a load/store's value, as opposed to convertTypeForMemory's type of the memory it lives in. | |
| mlir::Attribute | getBitIntStorageAttr (mlir::ConversionPatternRewriter &rewriter, cir::IntAttr attr, const mlir::DataLayout &dataLayout) |
| mlir::Type adjustGlobalTypeForInit | ( | mlir::Type | llvmType, |
| mlir::Attribute | init, | ||
| const mlir::TypeConverter & | converter, | ||
| const mlir::DataLayout & | dataLayout ) |
Adjust llvmType (the converted type of init) to the concrete LLVM type a global constant initialized with init actually lowers to.
This differs from a plain type conversion for flexible-array-member and union initializers, and the adjustment recurses through nested aggregates. Returns llvmType unchanged when no adjustment is needed. This is the single source of truth for the shape of a lowered record constant; the value-producing paths (the insertvalue visitor and lowerConstRecordAttr) conform to it. Returns null if the input type or an initializer type cannot be lowered.
Definition at line 909 of file LoweringHelpers.cpp.
References adjustGlobalTypeForInit().
| mlir::Type adjustGlobalTypeForInit | ( | mlir::Type | llvmType, |
| mlir::Attribute | init, | ||
| const mlir::TypeConverter & | converter, | ||
| const mlir::DataLayout & | dataLayout, | ||
| llvm::SmallVectorImpl< unsigned > & | paddingAddedIndexes ) |
Definition at line 874 of file LoweringHelpers.cpp.
References adjustGlobalArrayTypeForInit(), adjustGlobalStructTypeForInit(), and adjustGlobalUnionTypeForInit().
Referenced by adjustGlobalArrayTypeForInit(), adjustGlobalStructTypeForInit(), adjustGlobalTypeForInit(), adjustGlobalUnionTypeForInit(), lowerConstArrayAttrByElement(), and lowerConstRecordAttr().
| mlir::DenseElementsAttr convertStringAttrToDenseElementsAttr | ( | cir::ConstArrayAttr | attr, |
| mlir::Type | type ) |
Definition at line 155 of file LoweringHelpers.cpp.
References getIntOrBoolBitWidth().
Referenced by lowerConstArrayAttr().
| mlir::DenseElementsAttr convertToDenseElementsAttr | ( | cir::ConstArrayAttr | attr, |
| const llvm::SmallVectorImpl< int64_t > & | dims, | ||
| mlir::Type | type ) |
| void convertToDenseElementsAttrImpl | ( | cir::ConstArrayAttr | attr, |
| llvm::SmallVectorImpl< StorageTy > & | values ) |
Referenced by convertToDenseElementsAttr().
| mlir::Type convertTypeForLoadStore | ( | const mlir::TypeConverter & | converter, |
| mlir::DataLayout const & | dataLayout, | ||
| mlir::Type | type ) |
The type of a load/store's value, as opposed to convertTypeForMemory's type of the memory it lives in.
The two are effectively identical except with split-storage bit-int.
Definition at line 124 of file LoweringHelpers.cpp.
References convertTypeForMemory().
| mlir::Type convertTypeForMemory | ( | const mlir::TypeConverter & | converter, |
| mlir::DataLayout const & | dataLayout, | ||
| mlir::Type | type, | ||
| bool | isForHLSL = false ) |
Definition at line 74 of file LoweringHelpers.cpp.
References cir::MissingFeatures::hlsl().
Referenced by adjustGlobalUnionTypeForInit(), cir::direct::convertTypedArgAttrs(), convertTypeForLoadStore(), and cir::direct::prepareTypeConverter().
| mlir::Value createAnd | ( | mlir::OpBuilder & | bld, |
| mlir::Value | lhs, | ||
| const llvm::APInt & | rhs ) |
Definition at line 998 of file LoweringHelpers.cpp.
References getConstAPInt().
| mlir::Value createAShR | ( | mlir::OpBuilder & | bld, |
| mlir::Value | lhs, | ||
| unsigned | rhs ) |
Definition at line 991 of file LoweringHelpers.cpp.
References getConst().
| mlir::Value createLShR | ( | mlir::OpBuilder & | bld, |
| mlir::Value | lhs, | ||
| unsigned | rhs ) |
Definition at line 1004 of file LoweringHelpers.cpp.
References getConst().
| mlir::Value createShL | ( | mlir::OpBuilder & | bld, |
| mlir::Value | lhs, | ||
| unsigned | rhs ) |
Definition at line 984 of file LoweringHelpers.cpp.
References getConst().
| mlir::Attribute getBitIntStorageAttr | ( | mlir::ConversionPatternRewriter & | rewriter, |
| cir::IntAttr | attr, | ||
| const mlir::DataLayout & | dataLayout ) |
Definition at line 46 of file LoweringHelpers.cpp.
References bytes().
Referenced by cir::direct::GlobalInitAttrRewriter::visitCirAttr().
| mlir::Value getConst | ( | mlir::OpBuilder & | bld, |
| mlir::Location | loc, | ||
| mlir::Type | typ, | ||
| unsigned | val ) |
Definition at line 979 of file LoweringHelpers.cpp.
Referenced by createAShR(), createLShR(), and createShL().
| mlir::Value getConstAPInt | ( | mlir::OpBuilder & | bld, |
| mlir::Location | loc, | ||
| mlir::Type | typ, | ||
| const llvm::APInt & | val ) |
Definition at line 974 of file LoweringHelpers.cpp.
Referenced by createAnd().
| StorageTy getZeroInitFromType | ( | mlir::Type | ty | ) |
Referenced by convertToDenseElementsAttr().
| mlir::APInt getZeroInitFromType | ( | mlir::Type | ty | ) |
Definition at line 181 of file LoweringHelpers.cpp.
| mlir::APFloat getZeroInitFromType | ( | mlir::Type | ty | ) |
Definition at line 181 of file LoweringHelpers.cpp.
| std::optional< mlir::Attribute > lowerConstArrayAttr | ( | cir::ConstArrayAttr | constArr, |
| mlir::SymbolTableCollection & | symbolTables, | ||
| const mlir::TypeConverter * | converter, | ||
| mlir::ModuleOp | moduleOp = {} ) |
Definition at line 469 of file LoweringHelpers.cpp.
References containsBlockAddress(), containsPoison(), containsSplitTrailingZeros(), convertStringAttrToDenseElementsAttr(), convertToDenseElementsAttr(), lowerConstArrayAttrByElement(), lowerConstRecordMemberAttr(), and lowerPointerElementAttr().
Referenced by lowerConstArrayAttrByElement(), and lowerConstRecordMemberAttr().
| std::optional< mlir::Attribute > lowerConstRecordAttr | ( | cir::ConstRecordAttr | constRecord, |
| mlir::SymbolTableCollection & | symbolTables, | ||
| const mlir::TypeConverter * | converter, | ||
| mlir::ModuleOp | moduleOp = {} ) |
Definition at line 917 of file LoweringHelpers.cpp.
References adjustGlobalTypeForInit(), and lowerConstRecordMemberAttr().
Referenced by lowerConstRecordMemberAttr().
| mlir::Attribute spellOutSplitTrailingZeros | ( | mlir::Attribute | attr | ) |
Return attr with the trailing zeros of any array that adjustGlobalTypeForInit would split off written out as explicit zero elements, so that it lowers to its own type.
For constants that, unlike global initializers, cannot change type.
Definition at line 396 of file LoweringHelpers.cpp.
References containsSplitTrailingZeros(), shouldSplitTrailingZeros(), and spellOutSplitTrailingZeros().
Referenced by spellOutSplitTrailingZeros().