[clang] [clang-tools-extra] [llvm] [clang] Refactor Builtins.def to be a tablegen file (PR #68324)

Nikolas Klauser via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 07:33:04 PST 2024


================
@@ -6571,11 +6571,14 @@ class AtomicExpr : public Expr {
   /// \return empty atomic scope model if the atomic op code does not have
   ///   scope operand.
   static std::unique_ptr<AtomicScopeModel> getScopeModel(AtomicOp Op) {
-    if (Op >= AO__opencl_atomic_load && Op <= AO__opencl_atomic_fetch_max)
+    // FIXME: Allow grouping of builtins to be able to only check >= and <=
+    if (Op >= AO__opencl_atomic_compare_exchange_strong &&
+        Op <= AO__opencl_atomic_store && Op != AO__opencl_atomic_init)
----------------
philnik777 wrote:

I'd rather land this patch and improve things in follow-ups, since the refactoring is quite large and I'd like to avoid searching for added builtins again.

I've thought about adding something similar to the `InGroup<SomeGroup>` we have for diagnostics, but I don't have a patch yet. Maybe something like `InBuiltinRange<C11AtomicRange>`. That should make it trivial to teach tablegen to group the builtins, and maybe even generate functions to check whether a builtin is in a given range.

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


More information about the cfe-commits mailing list