[clang] [clang] constexpr atomic builtins (__c11_atomic_OP and __atomic_OP) (PR #98756)
Hana Dusíková via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 8 03:13:29 PST 2025
================
@@ -1921,6 +1921,22 @@ static bool EvaluateFixedPointOrInteger(const Expr *E, APFixedPoint &Result,
static bool EvaluateFixedPoint(const Expr *E, APFixedPoint &Result,
EvalInfo &Info);
+/// Support for atomic builtins
+static bool EvaluateAtomicOrder(const AtomicExpr *E, EvalInfo &Info);
+static bool EvaluateAtomicWeak(const AtomicExpr *E, EvalInfo &Info);
+static bool EvaluateAtomicLoad(const AtomicExpr *E, APValue &Result,
+ EvalInfo &Info);
+static bool EvaluatePointerAndStoreValueInto(Expr *ResultPtr,
+ APValue &ValueToStore,
+ EvalInfo &Info);
+static bool EvaluateAtomicLoadInto(const AtomicExpr *E, EvalInfo &Info);
+static bool EvaluateAtomicStore(const AtomicExpr *E, EvalInfo &Info);
+static bool EvaluateAtomicExchangeInto(const AtomicExpr *E, EvalInfo &Info);
+static bool EvaluateAtomicFetchOp(const AtomicExpr *E, APValue &Result,
+ EvalInfo &Info, bool StoreToResultAfter);
+static bool EvaluateAtomicCompareExchange(const AtomicExpr *E, APValue &Result,
+ EvalInfo &Info);
+
----------------
hanickadot wrote:
I inlined some small functions in bigger, but I'm not fan of long switches. I personally found them one of the reasons I struggle understand what's happening in ExprConstant.cpp as I found myself scrolling up/down. So I'm keeping them in their own functions.
https://github.com/llvm/llvm-project/pull/98756
More information about the cfe-commits
mailing list