GIMatchDagPredicateDependencyEdge.h 2.4 KB

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