xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/AMDGPUPredicateControl.td (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1//===-- AMDGPUPredicateControl.td --------------------------*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9def TruePredicate : Predicate<"">;
10
11// FIXME: Tablegen should specially supports this
12def FalsePredicate : Predicate<"false">;
13
14// Prevent using other kinds of predicates where True16 predicates are
15// expected by giving them their own class.
16class True16PredicateClass<string cond> : Predicate<cond>;
17def NoTrue16Predicate : True16PredicateClass<"">;
18
19class PredicateControl {
20  Predicate SubtargetPredicate = TruePredicate;
21  Predicate AssemblerPredicate = TruePredicate;
22  Predicate WaveSizePredicate = TruePredicate;
23  True16PredicateClass True16Predicate = NoTrue16Predicate;
24  list<Predicate> OtherPredicates = [];
25  list<Predicate> Predicates =
26      !foldl(OtherPredicates, [SubtargetPredicate, AssemblerPredicate,
27                               WaveSizePredicate, True16Predicate],
28             preds, p,
29             preds # !listremove([p], [TruePredicate, NoTrue16Predicate] # preds));
30}
31