• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- GIMatchDagPredicateDependencyEdge - Ensure predicates have inputs --===//
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 
9 #ifndef LLVM_UTILS_TABLEGEN_GIMATCHDAGPREDICATEEDGE_H
10 #define LLVM_UTILS_TABLEGEN_GIMATCHDAGPREDICATEEDGE_H
11 
12 #include "GIMatchDagOperands.h"
13 
14 namespace llvm {
15 class GIMatchDag;
16 class GIMatchDagInstr;
17 class GIMatchDagEdge;
18 class GIMatchDagPredicate;
19 
20 /// Represents a dependency that must be met to evaluate a predicate.
21 ///
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;
35 
36 public:
GIMatchDagPredicateDependencyEdge(const GIMatchDagInstr * RequiredMI,const GIMatchDagOperand * RequiredMO,const GIMatchDagPredicate * Predicate,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) {}
43 
getRequiredMI()44   const GIMatchDagInstr *getRequiredMI() const { return RequiredMI; }
getRequiredMO()45   const GIMatchDagOperand *getRequiredMO() const { return RequiredMO; }
getPredicate()46   const GIMatchDagPredicate *getPredicate() const { return Predicate; }
getPredicateOp()47   const GIMatchDagOperand *getPredicateOp() const { return PredicateOp; }
48 
49   void print(raw_ostream &OS) const;
50 
51 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
52   LLVM_DUMP_METHOD void dump() const;
53 #endif // if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
54 };
55 
56 raw_ostream &operator<<(raw_ostream &OS,
57                         const GIMatchDagPredicateDependencyEdge &N);
58 
59 } // end namespace llvm
60 #endif // ifndef LLVM_UTILS_TABLEGEN_GIMATCHDAGPREDICATEEDGE_H
61