1 //===- GIMatchDagPredicateDependencyEdge - Ensure predicates have inputs --===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_UTILS_TABLEGEN_GIMATCHDAGPREDICATEEDGE_H
10 #define LLVM_UTILS_TABLEGEN_GIMATCHDAGPREDICATEEDGE_H
12 #include "GIMatchDagOperands.h"
16 class GIMatchDagInstr
;
18 class GIMatchDagPredicate
;
20 /// Represents a dependency that must be met to evaluate a predicate.
22 /// Instances of this class objects are owned by the GIMatchDag and are not
23 /// shareable between instances of GIMatchDag.
24 class GIMatchDagPredicateDependencyEdge
{
25 /// The MI that must be available in order to test the predicate.
26 const GIMatchDagInstr
*RequiredMI
;
27 /// The MO that must be available in order to test the predicate. May be
28 /// nullptr when only the MI is required.
29 const GIMatchDagOperand
*RequiredMO
;
30 /// The Predicate that requires information from RequiredMI/RequiredMO.
31 const GIMatchDagPredicate
*Predicate
;
32 /// The Predicate operand that requires information from
33 /// RequiredMI/RequiredMO.
34 const GIMatchDagOperand
*PredicateOp
;
37 GIMatchDagPredicateDependencyEdge(const GIMatchDagInstr
*RequiredMI
,
38 const GIMatchDagOperand
*RequiredMO
,
39 const GIMatchDagPredicate
*Predicate
,
40 const GIMatchDagOperand
*PredicateOp
)
41 : RequiredMI(RequiredMI
), RequiredMO(RequiredMO
), Predicate(Predicate
),
42 PredicateOp(PredicateOp
) {}
44 const GIMatchDagInstr
*getRequiredMI() const { return RequiredMI
; }
45 const GIMatchDagOperand
*getRequiredMO() const { return RequiredMO
; }
46 const GIMatchDagPredicate
*getPredicate() const { return Predicate
; }
47 const GIMatchDagOperand
*getPredicateOp() const { return PredicateOp
; }
49 void print(raw_ostream
&OS
) const;
51 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
52 LLVM_DUMP_METHOD
void dump() const;
53 #endif // if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
56 raw_ostream
&operator<<(raw_ostream
&OS
,
57 const GIMatchDagPredicateDependencyEdge
&N
);
59 } // end namespace llvm
60 #endif // ifndef LLVM_UTILS_TABLEGEN_GIMATCHDAGPREDICATEEDGE_H