14#include "mlir/Dialect/Arith/IR/Arith.h"
15#include "mlir/Dialect/OpenACC/OpenACC.h"
23 mlir::Location boundLoc, mlir::Value lowerBound,
24 mlir::Value upperBound, mlir::Value extent) {
30 auto bound = mlir::acc::DataBoundsOp::create(builder, boundLoc, lowerBound,
32 bound.getStartIdxMutable().assign(startIdx);
34 bound.getExtentMutable().assign(extent);
35 bound.getStrideMutable().assign(stride);
45 mlir::IntegerType targetType = mlir::IntegerType::get(
48 ? mlir::IntegerType::SignednessSemantics::Signed
49 : mlir::IntegerType::SignednessSemantics::Unsigned);
51 return builder.createBuiltinIntCast(exprLoc,
expr, targetType);
57 mlir::IntegerType ty =
59 mlir::IntegerType::SignednessSemantics::Signless);
60 auto constOp = mlir::arith::ConstantOp::create(
61 builder, loc, builder.getIntegerAttr(ty, value));
72 if (
const auto *section =
74 origType = section->getElementType();
80 std::string exprString;
81 llvm::raw_string_ostream os(exprString);
84 auto addBoundType = [&](
const Expr *e) {
85 if (
const auto *section = dyn_cast<ArraySectionExpr>(curVarExpr))
86 boundTypes.push_back(section->getElementType());
88 boundTypes.push_back(curVarExpr->
getType());
91 addBoundType(curVarExpr);
95 mlir::Value lowerBound;
96 mlir::Value upperBound;
99 if (
const auto *section = dyn_cast<ArraySectionExpr>(curVarExpr)) {
100 if (
const Expr *lb = section->getLowerBound())
105 if (
const Expr *len = section->getLength()) {
108 QualType baseTy = section->getBaseType();
116 arrayTy->getLimitedSize() - 1);
129 bounds.push_back(createBound(*
this, this->builder, boundLoc, lowerBound,
130 upperBound, extent));
131 addBoundType(curVarExpr);
134 if (
const auto *memExpr = dyn_cast<MemberExpr>(curVarExpr))
141 std::move(boundTypes)};
154 std::move(boundTypes)};
Defines the clang::Expr interface and subclasses for C++ expressions.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
LValue emitMemberExpr(const MemberExpr *e)
OpenACCDataOperandInfo getOpenACCDataOperandInfo(const Expr *e)
mlir::Value emitScalarExpr(const clang::Expr *e, bool ignoreResultAssign=false)
Emit the computation of the specified expression of scalar type.
mlir::Value emitOpenACCIntExpr(const Expr *intExpr)
mlir::MLIRContext & getMLIRContext()
mlir::Value createOpenACCConstantInt(mlir::Location loc, unsigned width, int64_t value)
LValue emitDeclRefLValue(const clang::DeclRefExpr *e)
clang::ASTContext & getContext() const
mlir::Value getPointer() const
This represents one expression.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
A (possibly-)qualified type.
QualType getNonReferenceType() const
If Type is a reference type (e.g., const int&), returns the type that the reference refers to ("const...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
void printPretty(raw_ostream &OS, PrinterHelper *Helper, const PrintingPolicy &Policy, unsigned Indentation=0, StringRef NewlineSymbol="\n", const ASTContext *Context=nullptr) const
SourceLocation getBeginLoc() const LLVM_READONLY
bool isSignedIntegerOrEnumerationType() const
Determines whether this is an integer type that is signed or an enumeration types whose underlying ty...
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
U cast(CodeGen::Address addr)