00001 //StmtDFSet.cpp 00002 00003 /*#include "StmtDFSet.hpp" 00004 #include <Utils/Util.hpp> 00005 00006 namespace OA { 00007 namespace DataFlow { 00008 00009 static bool debug = false; 00010 00011 StmtDFSet::StmtDFSet() 00012 { 00013 OA_DEBUG_CTRL_MACRO("DEBUG_StmtDFSet:ALL", debug); 00014 } 00015 00016 StmtDFSet::StmtDFSet(const StmtDFSet &other): mSet(other.mSet){} 00017 00018 00019 OA_ptr<DataFlowSet> StmtDFSet::clone() 00020 { 00021 OA_ptr<StmtDFSet> retval; 00022 retval = new StmtDFSet(*this); 00023 return retval; 00024 } 00025 00026 // param for these can't be const because will have to 00027 // dynamic cast to specific subclass 00028 bool StmtDFSet::operator ==(DataFlowSet &other) const 00029 { 00030 StmtDFSet& recastOther 00031 = dynamic_cast<StmtDFSet&>(other); 00032 return mSet == recastOther.mSet; 00033 } 00034 00035 bool StmtDFSet::operator !=(DataFlowSet &other) const 00036 { 00037 StmtDFSet& recastOther 00038 = dynamic_cast<StmtDFSet&>(other); 00039 return mSet != recastOther.mSet; 00040 } 00041 00042 bool StmtDFSet::operator <(DataFlowSet &other) const 00043 { 00044 00045 } 00046 00047 StmtDFSet& StmtDFSet::setUnion(DataFlowSet &other) 00048 { 00049 StmtDFSet& recastOther 00050 = dynamic_cast<StmtDFSet&>(other); 00051 std::set<StmtHandle> temp; 00052 std::set_union(mSet.begin(), mSet.end(), 00053 recastOther.mSet.begin(), recastOther.mSet.end(), 00054 std::inserter(temp,temp.end())); 00055 mSet = temp; 00056 return *this; 00057 } 00058 00059 StmtDFSet& StmtDFSet::setIntersect(StmtDFSet &other) 00060 { 00061 std::set<StmtHandle> temp; 00062 std::set_intersection(mSet.begin(), mSet.end(), 00063 other.mSet.begin(), other.mSet.end(), 00064 std::inserter(temp,temp.end())); 00065 mSet = temp; 00066 return *this; 00067 } 00068 00069 StmtDFSet& StmtDFSet::setDifference(DataFlowSet &other) 00070 { 00071 OA_ptr<LocSet> temp; temp = new LocSet; 00072 std::set_difference(mSetPtr->begin(), mSetPtr->end(), 00073 other.mSetPtr->begin(), other.mSetPtr->end(), 00074 std::inserter(*temp,temp->end())); 00075 *mSetPtr = *temp; 00076 mBaseLocToSetMapValid = false; 00077 return *this; 00078 } 00079 00080 void StmtDFSet::dump(std::ostream &os) 00081 { 00082 os << "StmtDFSet: mSet = "; 00083 // iterate over IRHandle's and print out hvals 00084 std::set<StmtHandle>::iterator iter; 00085 for (iter=mSet.begin(); iter!=mSet.end(); iter++) { 00086 os << (*iter).hval() << ", "; 00087 } 00088 os << std::endl; 00089 } 00090 00091 00092 void StmtDFSet::dump(std::ostream &os, OA_ptr<IRHandlesIRInterface> ir) 00093 { 00094 os << "StmtDFSet: mSet = "; 00095 // iterate over IRHandle's and have the IR print them out 00096 std::set<StmtHandle>::iterator iter; 00097 for (iter=mSet.begin(); iter!=mSet.end(); iter++) { 00098 os << ir->toString(*iter) << ", "; 00099 } 00100 os << std::endl; 00101 } 00102 00103 00104 void StmtDFSet::insert(StmtHandle h) { mSet.insert(h); } 00105 void StmtDFSet::remove(StmtHandle h) { mSet.erase(h); } 00106 00107 bool StmtDFSet::handleInSet(StmtHandle h) { return (mSet.find(h)!=mSet.end()); } 00108 00109 bool StmtDFSet::empty() { return mSet.empty(); } 00110 00111 } // end of DataFlow namespace 00112 } // end of OA namespace 00113 */
1.7.1