X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FAnalysis%2FLiveVar%2FValueSet.cpp;h=1914f033020ae19480236ed1289d686755ef8dbb;hb=24ea74eb9a47b81c1557926acd83e0fbe6d7594e;hp=d176d9e53cffcf58f6f92655675edc3299449b78;hpb=697954c15da58bd8b186dbafdedd8b06db770201;p=oota-llvm.git diff --git a/lib/Analysis/LiveVar/ValueSet.cpp b/lib/Analysis/LiveVar/ValueSet.cpp index d176d9e53cf..1914f033020 100644 --- a/lib/Analysis/LiveVar/ValueSet.cpp +++ b/lib/Analysis/LiveVar/ValueSet.cpp @@ -1,65 +1,22 @@ + + #include "llvm/Analysis/LiveVar/ValueSet.h" -#include "llvm/ConstantVals.h" +#include "llvm/Value.h" #include -using std::cerr; -using std::endl; -using std::pair; -using std::hash_set; -void printValue( const Value *const v) // func to print a Value -{ - if (v->hasName()) - cerr << v << "(" << ((*v).getName()) << ") "; - else if (Constant *C = dyn_cast(v)) - cerr << v << "(" << C->getStrValue() << ") "; +std::ostream &operator<<(std::ostream &O, RAV V) { // func to print a Value + const Value &v = V.V; + if (v.hasName()) + return O << (void*)&v << "(" << v.getName() << ") "; + else if (isa(v)) + return O << (void*)&v << "(" << v << ") "; else - cerr << v << " "; -} - - -//---------------- Method implementations -------------------------- - // for performing two set unions -bool ValueSet::setUnion( const ValueSet *const set1) { - const_iterator set1it; - pair result; - bool changed = false; - - for( set1it = set1->begin() ; set1it != set1->end(); ++set1it) { - // for all all elements in set1 - result = insert( *set1it ); // insert to this set - if( result.second == true) changed = true; - } - - return changed; -} - - - // for performing set difference -void ValueSet::setDifference( const ValueSet *const set1, - const ValueSet *const set2) { - - const_iterator set1it, set2it; - for( set1it = set1->begin() ; set1it != set1->end(); ++set1it) { - // for all elements in set1 - iterator set2it = set2->find( *set1it ); // find wether the elem is in set2 - if( set2it == set2->end() ) // if the element is not in set2 - insert( *set1it ); // insert to this set - } + return O << (void*)&v << " "; } - - // for performing set subtraction -void ValueSet::setSubtract( const ValueSet *const set1) { - const_iterator set1it; - for( set1it = set1->begin() ; set1it != set1->end(); ++set1it) - // for all elements in set1 - erase( *set1it ); // erase that element from this set +void printSet(const ValueSet &S) { + for (ValueSet::const_iterator I = S.begin(), E = S.end(); I != E; ++I) + std::cerr << RAV(*I); } - - - -void ValueSet::printSet() const { // for printing a live variable set - for_each(begin(), end(), printValue); -}