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