[flang] [llvm] [flang][OpenMP] Overhaul implementation of ATOMIC construct (PR #137852)
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Thu May 29 11:56:21 PDT 2025
================
@@ -777,5 +777,22 @@ inline bool checkForSymbolMatch(const Fortran::semantics::SomeExpr *lhs,
}
return false;
}
+
+/// If the top-level operation (ignoring parentheses) is either an
+/// evaluate::FunctionRef, or a specialization of evaluate::Operation,
+/// then return the list of arguments (wrapped in SomeExpr). Otherwise,
+/// return the "expr" but with top-level parentheses stripped.
+std::vector<SomeExpr> GetOpenMPTopLevelArguments(const SomeExpr &expr);
+
+/// Check if expr is same as x, or a sequence of Convert operations on x.
+bool IsSameOrConvertOf(const SomeExpr &expr, const SomeExpr &x);
+
+/// Strip away any top-level Convert operations (if any exist) and return
+/// the input value. A ComplexConstructor(x, 0) is also considered as a
+/// convert operation.
+/// If the input is not Operation, Designator, FunctionRef or Constant,
+/// is returns std::nullopt.
+MaybeExpr GetConvertInput(const SomeExpr &x);
+
----------------
kparzysz wrote:
The implementations all use the "atomic" namespace in check-omp-structure.cpp, which I'd rather keep "private" to that file. If you think these declarations don't belong here, then maybe we could invent a new header omp-tools.h or something like that? Let me know what you think.
https://github.com/llvm/llvm-project/pull/137852
More information about the llvm-commits
mailing list