20 mlir::Operation *op = varPtr.getDefiningOp();
21 assert(op &&
"Expected a defining operation");
24 if (
auto allocaOp = mlir::dyn_cast<cir::AllocaOp>(*op))
25 return allocaOp.getAllocaType();
28 if (
auto castOp = mlir::dyn_cast<cir::CastOp>(*op))
32 if (
auto ptrStrideOp = mlir::dyn_cast<cir::PtrStrideOp>(*op))
35 if (
auto getMemberOp = mlir::dyn_cast<cir::GetMemberOp>(*op))
38 return mlir::cast<cir::PointerType>(varPtr.getType()).getPointee();
42mlir::acc::VariableTypeCategory
44 mlir::Type pointer, mlir::TypedValue<mlir::acc::PointerLikeType> varPtr,
45 mlir::Type varType)
const {
48 if (
auto mappableTy = mlir::dyn_cast<mlir::acc::MappableType>(eleTy))
49 return mappableTy.getTypeCategory(varPtr);
51 if (isAnyIntegerOrFloatingPointType(eleTy) ||
52 mlir::isa<cir::BoolType>(eleTy) || mlir::isa<cir::PointerType>(eleTy))
53 return mlir::acc::VariableTypeCategory::scalar;
54 if (mlir::isa<cir::ArrayType>(eleTy))
55 return mlir::acc::VariableTypeCategory::array;
56 if (mlir::isa<cir::RecordType>(eleTy))
57 return mlir::acc::VariableTypeCategory::composite;
58 if (mlir::isa<cir::FuncType>(eleTy) || mlir::isa<cir::VectorType>(eleTy))
59 return mlir::acc::VariableTypeCategory::nonscalar;
62 return mlir::acc::VariableTypeCategory::uncategorized;
mlir::Type getBaseType(mlir::Value varPtr)
mlir::acc::VariableTypeCategory getPointeeTypeCategory(mlir::Type pointer, mlir::TypedValue< mlir::acc::PointerLikeType > varPtr, mlir::Type varType) const