@@ -94,6 +94,23 @@ mlir::LogicalResult CIRGenFunction::emitOpenACCOpAssociatedStmt(
94
94
return res;
95
95
}
96
96
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
+
97
114
mlir::LogicalResult
98
115
CIRGenFunction::emitOpenACCComputeConstruct (const OpenACCComputeConstruct &s) {
99
116
mlir::Location start = getLoc (s.getSourceRange ().getEnd ());
@@ -123,6 +140,17 @@ CIRGenFunction::emitOpenACCDataConstruct(const OpenACCDataConstruct &s) {
123
140
start, end, s.clauses (), s.getStructuredBlock ());
124
141
}
125
142
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
+
126
154
mlir::LogicalResult
127
155
CIRGenFunction::emitOpenACCLoopConstruct (const OpenACCLoopConstruct &s) {
128
156
getCIRGenModule ().errorNYI (s.getSourceRange (), " OpenACC Loop Construct" );
@@ -154,16 +182,6 @@ CIRGenFunction::emitOpenACCWaitConstruct(const OpenACCWaitConstruct &s) {
154
182
return mlir::failure ();
155
183
}
156
184
mlir::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
167
185
CIRGenFunction::emitOpenACCSetConstruct (const OpenACCSetConstruct &s) {
168
186
getCIRGenModule ().errorNYI (s.getSourceRange (), " OpenACC Set Construct" );
169
187
return mlir::failure ();
0 commit comments