12#ifndef LLVM_CLANG_CIR_LOWERINGHELPERS_H
13#define LLVM_CLANG_CIR_LOWERINGHELPERS_H
15#include "mlir/IR/BuiltinAttributes.h"
16#include "mlir/Transforms/DialectConversion.h"
19mlir::DenseElementsAttr
26template <
typename AttrTy,
typename StorageTy>
30template <
typename AttrTy,
typename StorageTy>
31mlir::DenseElementsAttr
36std::optional<mlir::Attribute>
38 const mlir::TypeConverter *converter);
40mlir::Value
getConstAPInt(mlir::OpBuilder &bld, mlir::Location loc,
41 mlir::Type typ,
const llvm::APInt &val);
43mlir::Value
getConst(mlir::OpBuilder &bld, mlir::Location loc, mlir::Type typ,
46mlir::Value
createShL(mlir::OpBuilder &bld, mlir::Value lhs,
unsigned rhs);
48mlir::Value
createAShR(mlir::OpBuilder &bld, mlir::Value lhs,
unsigned rhs);
50mlir::Value
createAnd(mlir::OpBuilder &bld, mlir::Value lhs,
51 const llvm::APInt &rhs);
53mlir::Value
createLShR(mlir::OpBuilder &bld, mlir::Value lhs,
unsigned rhs);
mlir::DenseElementsAttr convertStringAttrToDenseElementsAttr(cir::ConstArrayAttr attr, mlir::Type type)
mlir::Value createLShR(mlir::OpBuilder &bld, mlir::Value lhs, unsigned rhs)
mlir::Value createShL(mlir::OpBuilder &bld, mlir::Value lhs, unsigned rhs)
mlir::Value getConst(mlir::OpBuilder &bld, mlir::Location loc, mlir::Type typ, unsigned val)
mlir::Value getConstAPInt(mlir::OpBuilder &bld, mlir::Location loc, mlir::Type typ, const llvm::APInt &val)
mlir::DenseElementsAttr convertToDenseElementsAttr(cir::ConstArrayAttr attr, const llvm::SmallVectorImpl< int64_t > &dims, mlir::Type type)
std::optional< mlir::Attribute > lowerConstArrayAttr(cir::ConstArrayAttr constArr, const mlir::TypeConverter *converter)
mlir::Value createAShR(mlir::OpBuilder &bld, mlir::Value lhs, unsigned rhs)
StorageTy getZeroInitFromType(mlir::Type ty)
mlir::Value createAnd(mlir::OpBuilder &bld, mlir::Value lhs, const llvm::APInt &rhs)
void convertToDenseElementsAttrImpl(cir::ConstArrayAttr attr, llvm::SmallVectorImpl< StorageTy > &values)