ValueLattice.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. //===- ValueLattice.cpp - Value constraint analysis -------------*- C++ -*-===//
  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. #include "llvm/Analysis/ValueLattice.h"
  9. namespace llvm {
  10. raw_ostream &operator<<(raw_ostream &OS, const ValueLatticeElement &Val) {
  11. if (Val.isUnknown())
  12. return OS << "unknown";
  13. if (Val.isUndef())
  14. return OS << "undef";
  15. if (Val.isOverdefined())
  16. return OS << "overdefined";
  17. if (Val.isNotConstant())
  18. return OS << "notconstant<" << *Val.getNotConstant() << ">";
  19. if (Val.isConstantRangeIncludingUndef())
  20. return OS << "constantrange incl. undef <"
  21. << Val.getConstantRange(true).getLower() << ", "
  22. << Val.getConstantRange(true).getUpper() << ">";
  23. if (Val.isConstantRange())
  24. return OS << "constantrange<" << Val.getConstantRange().getLower() << ", "
  25. << Val.getConstantRange().getUpper() << ">";
  26. return OS << "constant<" << *Val.getConstant() << ">";
  27. }
  28. } // end namespace llvm