Ruchira Sasanka | 683847f | 2001-07-24 17:14:13 +0000 | [diff] [blame] | 1 | |
Chris Lattner | 0665a5f | 2002-02-05 01:43:49 +0000 | [diff] [blame] | 2 | |
3 | |||||
Ruchira Sasanka | 683847f | 2001-07-24 17:14:13 +0000 | [diff] [blame] | 4 | #include "llvm/Analysis/LiveVar/ValueSet.h" |
Chris Lattner | e9bb2df | 2001-12-03 22:26:30 +0000 | [diff] [blame] | 5 | #include "llvm/ConstantVals.h" |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 6 | #include <iostream> |
Ruchira Sasanka | 683847f | 2001-07-24 17:14:13 +0000 | [diff] [blame] | 7 | |
Chris Lattner | 0665a5f | 2002-02-05 01:43:49 +0000 | [diff] [blame] | 8 | ostream &operator<<(ostream &O, RAV V) { // func to print a Value |
9 | const Value *v = V.V; | ||||
Chris Lattner | 634b352 | 2001-10-15 18:30:06 +0000 | [diff] [blame] | 10 | if (v->hasName()) |
Chris Lattner | 0665a5f | 2002-02-05 01:43:49 +0000 | [diff] [blame] | 11 | return O << v << "(" << v->getName() << ") "; |
Chris Lattner | e9bb2df | 2001-12-03 22:26:30 +0000 | [diff] [blame] | 12 | else if (Constant *C = dyn_cast<Constant>(v)) |
Chris Lattner | 0665a5f | 2002-02-05 01:43:49 +0000 | [diff] [blame] | 13 | return O << v << "(" << C->getStrValue() << ") "; |
Ruchira Sasanka | e27c344 | 2001-08-20 21:12:49 +0000 | [diff] [blame] | 14 | else |
Chris Lattner | 0665a5f | 2002-02-05 01:43:49 +0000 | [diff] [blame] | 15 | return O << v << " "; |
Ruchira Sasanka | 683847f | 2001-07-24 17:14:13 +0000 | [diff] [blame] | 16 | } |
17 | |||||
Chris Lattner | 5e5dfa3 | 2002-02-05 02:51:01 +0000 | [diff] [blame^] | 18 | void printSet(const ValueSet &S) { |
19 | for (ValueSet::const_iterator I = S.begin(), E = S.end(); I != E; ++I) | ||||
Chris Lattner | 0665a5f | 2002-02-05 01:43:49 +0000 | [diff] [blame] | 20 | std::cerr << RAV(*I); |
Ruchira Sasanka | 683847f | 2001-07-24 17:14:13 +0000 | [diff] [blame] | 21 | } |
Chris Lattner | 5e5dfa3 | 2002-02-05 02:51:01 +0000 | [diff] [blame^] | 22 |