[llvm-branch-commits] [llvm] RuntimeLibcalls: Reuse AssemblerPredicate's operators for libcalls (PR #210651)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jul 20 01:56:57 PDT 2026
================
@@ -8,13 +8,40 @@
include "llvm/TableGen/SetTheory.td"
+// Dag operators for composing predicates.
+def all_of;
+def any_of;
+def not;
+
+// Composable predicate leaf expressed as a C++ boolean over an
+// `Triple TT`. Generally should check a single triple property.
+class LibcallPredicate<code cond> {
+ code Cond = cond;
+}
+
// Predicate for whether a libcall exists for the target ABI. This is
// a module level property that should only be computed based on the
// triple.
-class RuntimeLibcallAvailability<code cond> {
- // Expression of an llvm::Triple named TT for whether a libcall
+//
+// Two forms are accepted:
+// - a raw C++ `code` condition over `Triple TT`
+// - a `dag` of LibcallPredicate leaves combined with all_of/any_of/not,
+// which the emitter lowers to the equivalent C++ boolean.
+// The dag form takes precedence when present.
+//
+// TODO: Remove the C++ form
+class RuntimeLibcallAvailability<code cond = [{}]> {
+ // Expression of an Triple named TT for whether a libcall
// should exist.
code Cond = cond;
+
+ // Composable form: (all_of/any_of/not <LibcallPredicate>...). Unset (?)
+ // means the `Cond` code form is used instead.
+ dag CondDag = ?;
+}
+
+class RuntimeLibcallAvailabilityDag<dag cond> : RuntimeLibcallAvailability<[{}]> {
----------------
arsenm wrote:
I guess I could fold the rename into the DAG conversion, but it's not worth the hassle given that I can no longer reorder stacked PRs without close and reopen
https://github.com/llvm/llvm-project/pull/210651
More information about the llvm-branch-commits
mailing list