@@ -94,6 +94,23 @@ mlir::LogicalResult CIRGenFunction::emitOpenACCOpAssociatedStmt(
9494 return res;
9595}
9696
97+ template <typename Op>
98+ mlir::LogicalResult
99+ CIRGenFunction::emitOpenACCOp (mlir::Location start,
100+ llvm::ArrayRef<const OpenACCClause *> clauses) {
101+ mlir::LogicalResult res = mlir::success ();
102+
103+ llvm::SmallVector<mlir::Type> retTy;
104+ llvm::SmallVector<mlir::Value> operands;
105+
106+ // Clause-emitter must be here because it might modify operands.
107+ OpenACCClauseCIREmitter clauseEmitter (getCIRGenModule ());
108+ clauseEmitter.VisitClauseList (clauses);
109+
110+ builder.create <Op>(start, retTy, operands);
111+ return res;
112+ }
113+
97114mlir::LogicalResult
98115CIRGenFunction::emitOpenACCComputeConstruct (const OpenACCComputeConstruct &s) {
99116 mlir::Location start = getLoc (s.getSourceRange ().getEnd ());
@@ -123,6 +140,17 @@ CIRGenFunction::emitOpenACCDataConstruct(const OpenACCDataConstruct &s) {
123140 start, end, s.clauses (), s.getStructuredBlock ());
124141}
125142
143+ mlir::LogicalResult
144+ CIRGenFunction::emitOpenACCInitConstruct (const OpenACCInitConstruct &s) {
145+ mlir::Location start = getLoc (s.getSourceRange ().getEnd ());
146+ return emitOpenACCOp<InitOp>(start, s.clauses ());
147+ }
148+ mlir::LogicalResult CIRGenFunction::emitOpenACCShutdownConstruct (
149+ const OpenACCShutdownConstruct &s) {
150+ mlir::Location start = getLoc (s.getSourceRange ().getEnd ());
151+ return emitOpenACCOp<ShutdownOp>(start, s.clauses ());
152+ }
153+
126154mlir::LogicalResult
127155CIRGenFunction::emitOpenACCLoopConstruct (const OpenACCLoopConstruct &s) {
128156 getCIRGenModule ().errorNYI (s.getSourceRange (), " OpenACC Loop Construct" );
@@ -154,16 +182,6 @@ CIRGenFunction::emitOpenACCWaitConstruct(const OpenACCWaitConstruct &s) {
154182 return mlir::failure ();
155183}
156184mlir::LogicalResult
157- CIRGenFunction::emitOpenACCInitConstruct (const OpenACCInitConstruct &s) {
158- getCIRGenModule ().errorNYI (s.getSourceRange (), " OpenACC Init Construct" );
159- return mlir::failure ();
160- }
161- mlir::LogicalResult CIRGenFunction::emitOpenACCShutdownConstruct (
162- const OpenACCShutdownConstruct &s) {
163- getCIRGenModule ().errorNYI (s.getSourceRange (), " OpenACC Shutdown Construct" );
164- return mlir::failure ();
165- }
166- mlir::LogicalResult
167185CIRGenFunction::emitOpenACCSetConstruct (const OpenACCSetConstruct &s) {
168186 getCIRGenModule ().errorNYI (s.getSourceRange (), " OpenACC Set Construct" );
169187 return mlir::failure ();
0 commit comments