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