[clang] [llvm] [Clang][AArch64] Add customisable immediate range checking to NEON (PR #100278)
Momchil Velikov via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 2 03:36:51 PDT 2024
================
@@ -403,142 +369,183 @@ enum ArmSMEState : unsigned {
ArmZT0Mask = 0b11 << 2
};
+bool SemaARM::CheckImmediateArg(CallExpr *TheCall, unsigned CheckTy,
+ unsigned ArgIdx, unsigned EltBitWidth,
+ unsigned VecBitWidth) {
+
+ typedef bool (*OptionSetCheckFnTy)(int64_t Value);
+
+ // Function that checks whether the operand (ArgIdx) is an immediate
+ // that is one of the predefined values.
+ auto CheckImmediateInSet = [&](OptionSetCheckFnTy CheckImm,
----------------
momchil-velikov wrote:
Naming and description: the lambda is actually more universal than just checking if an immediate is one of several predefined values - its current usage corresponds to the description, but not the lambda itself. I would suggest either renaming it to something like `CheckImmediateWithPredicate` or modifying it to take as a parameter the set of values to test against (perhaps as `std::initializer_list<int64_t>`, so one can call it like `foo(Arg, {1, 2, 3})`).
https://github.com/llvm/llvm-project/pull/100278
More information about the cfe-commits
mailing list