31 lines · plain
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-exception6//7//===----------------------------------------------------------------------===//8 9def TruePredicate : Predicate<"">;10 11// FIXME: Tablegen should specially supports this12def FalsePredicate : Predicate<"false">;13 14// Prevent using other kinds of predicates where True16 predicates are15// 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