Florian Hahn | 8af0157 | 2017-09-28 11:09:22 +0000 | [diff] [blame] | 1 | //===- ValueLattice.cpp - Value constraint analysis -------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Florian Hahn | 8af0157 | 2017-09-28 11:09:22 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/Analysis/ValueLattice.h" |
| 10 | |
| 11 | namespace llvm { |
| 12 | raw_ostream &operator<<(raw_ostream &OS, const ValueLatticeElement &Val) { |
| 13 | if (Val.isUndefined()) |
| 14 | return OS << "undefined"; |
| 15 | if (Val.isOverdefined()) |
| 16 | return OS << "overdefined"; |
| 17 | |
| 18 | if (Val.isNotConstant()) |
| 19 | return OS << "notconstant<" << *Val.getNotConstant() << ">"; |
| 20 | if (Val.isConstantRange()) |
| 21 | return OS << "constantrange<" << Val.getConstantRange().getLower() << ", " |
| 22 | << Val.getConstantRange().getUpper() << ">"; |
| 23 | return OS << "constant<" << *Val.getConstant() << ">"; |
| 24 | } |
| 25 | } // end namespace llvm |