[clang] [OpenACC] Implement 'num_workers' clause for compute constructs (PR #89151)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 18 06:58:43 PDT 2024


================
@@ -156,6 +156,64 @@ class OpenACCSelfClause : public OpenACCClauseWithCondition {
                                    Expr *ConditionExpr, SourceLocation EndLoc);
 };
 
+/// Represents one of a handful of classes that have integer expressions.
+/// Semantically, many only permit a single expression, with a few that permit
+/// up to 3.
+class OpenACCClauseWithIntExprs : public OpenACCClauseWithParams {
+  llvm::SmallVector<Expr *> IntExprs;
----------------
erichkeane wrote:

There are OTHER clauses coming in the future that use multiple `Exprs`, so I'm designing the class hierarchy to handle that as well.  The intent is for THIS class to be the base for all that have `IntExprs`, but the one I am implementing NOW is only a 'single' Expr*.

So my intent is that I WILL use the trailing-storage on the ones that take multiples (and have now done the changes so that will be possible, by making this an arrayref), but as an optimization, just use a DataMember for the 'special cases' where there is only 1.

https://github.com/llvm/llvm-project/pull/89151


More information about the cfe-commits mailing list