[clang] [OpenACC][CIR] Implement beginning of 'copy' lowering for compute con… (PR #140304)
Andy Kaylor via cfe-commits
cfe-commits at lists.llvm.org
Fri May 16 15:45:55 PDT 2025
================
@@ -36,6 +37,76 @@ template <typename ToTest> constexpr bool isCombinedType = false;
template <typename T>
constexpr bool isCombinedType<CombinedConstructClauseInfo<T>> = true;
+namespace {
+struct DataOperandInfo {
+ mlir::Location beginLoc;
+ mlir::Value varValue;
+ llvm::StringRef name;
+ mlir::ValueRange bounds;
+
+ DataOperandInfo(mlir::Location beginLoc, mlir::Value varValue,
+ llvm::StringRef name, mlir::ValueRange bounds)
+ : beginLoc(beginLoc), varValue(varValue), name(name), bounds(bounds) {}
+};
+
+inline mlir::Value createIntExpr(CIRGen::CIRGenFunction &cgf,
+ CIRGen::CIRGenBuilderTy &builder,
+ const Expr *intExpr) {
+ mlir::Value expr = cgf.emitScalarExpr(intExpr);
+ mlir::Location exprLoc = cgf.cgm.getLoc(intExpr->getBeginLoc());
+
+ mlir::IntegerType targetType = mlir::IntegerType::get(
+ &cgf.getMLIRContext(), cgf.getContext().getIntWidth(intExpr->getType()),
+ intExpr->getType()->isSignedIntegerOrEnumerationType()
+ ? mlir::IntegerType::SignednessSemantics::Signed
+ : mlir::IntegerType::SignednessSemantics::Unsigned);
+
+ auto conversionOp = builder.create<mlir::UnrealizedConversionCastOp>(
+ exprLoc, targetType, expr);
+ return conversionOp.getResult(0);
+}
+
+// A helper function that gets the information from an operand to a data
+// clause, so that it can be used to emit the data operations.
+inline DataOperandInfo getDataOperandInfo(CIRGen::CIRGenFunction &cgf,
+ CIRGen::CIRGenBuilderTy &builder,
+ OpenACCDirectiveKind DK,
+ const Expr *E) {
----------------
andykaylor wrote:
```suggestion
const Expr *e) {
```
https://github.com/llvm/llvm-project/pull/140304
More information about the cfe-commits
mailing list