OpenADFortTk (including Open64 and OpenAnalysis references)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
StmtDFSet.cpp
Go to the documentation of this file.
1 //StmtDFSet.cpp
2 
3 /*#include "StmtDFSet.hpp"
4 #include <Utils/Util.hpp>
5 
6 namespace OA {
7  namespace DataFlow {
8 
9 static bool debug = false;
10 
11 StmtDFSet::StmtDFSet()
12 {
13  OA_DEBUG_CTRL_MACRO("DEBUG_StmtDFSet:ALL", debug);
14 }
15 
16 StmtDFSet::StmtDFSet(const StmtDFSet &other): mSet(other.mSet){}
17 
18 
19 OA_ptr<DataFlowSet> StmtDFSet::clone()
20 {
21  OA_ptr<StmtDFSet> retval;
22  retval = new StmtDFSet(*this);
23  return retval;
24 }
25 
26 // param for these can't be const because will have to
27 // dynamic cast to specific subclass
28 bool StmtDFSet::operator ==(DataFlowSet &other) const
29 {
30  StmtDFSet& recastOther
31  = dynamic_cast<StmtDFSet&>(other);
32  return mSet == recastOther.mSet;
33 }
34 
35 bool StmtDFSet::operator !=(DataFlowSet &other) const
36 {
37  StmtDFSet& recastOther
38  = dynamic_cast<StmtDFSet&>(other);
39  return mSet != recastOther.mSet;
40 }
41 
42 bool StmtDFSet::operator <(DataFlowSet &other) const
43 {
44 
45 }
46 
47 StmtDFSet& StmtDFSet::setUnion(DataFlowSet &other)
48 {
49  StmtDFSet& recastOther
50  = dynamic_cast<StmtDFSet&>(other);
51  std::set<StmtHandle> temp;
52  std::set_union(mSet.begin(), mSet.end(),
53  recastOther.mSet.begin(), recastOther.mSet.end(),
54  std::inserter(temp,temp.end()));
55  mSet = temp;
56  return *this;
57 }
58 
59 StmtDFSet& StmtDFSet::setIntersect(StmtDFSet &other)
60  {
61  std::set<StmtHandle> temp;
62  std::set_intersection(mSet.begin(), mSet.end(),
63  other.mSet.begin(), other.mSet.end(),
64  std::inserter(temp,temp.end()));
65  mSet = temp;
66  return *this;
67  }
68 
69 StmtDFSet& StmtDFSet::setDifference(DataFlowSet &other)
70 {
71  OA_ptr<LocSet> temp; temp = new LocSet;
72  std::set_difference(mSetPtr->begin(), mSetPtr->end(),
73  other.mSetPtr->begin(), other.mSetPtr->end(),
74  std::inserter(*temp,temp->end()));
75  *mSetPtr = *temp;
76  mBaseLocToSetMapValid = false;
77  return *this;
78 }
79 
80 void StmtDFSet::dump(std::ostream &os)
81  {
82  os << "StmtDFSet: mSet = ";
83  // iterate over IRHandle's and print out hvals
84  std::set<StmtHandle>::iterator iter;
85  for (iter=mSet.begin(); iter!=mSet.end(); iter++) {
86  os << (*iter).hval() << ", ";
87  }
88  os << std::endl;
89  }
90 
91 
92 void StmtDFSet::dump(std::ostream &os, OA_ptr<IRHandlesIRInterface> ir)
93  {
94  os << "StmtDFSet: mSet = ";
95  // iterate over IRHandle's and have the IR print them out
96  std::set<StmtHandle>::iterator iter;
97  for (iter=mSet.begin(); iter!=mSet.end(); iter++) {
98  os << ir->toString(*iter) << ", ";
99  }
100  os << std::endl;
101  }
102 
103 
104  void StmtDFSet::insert(StmtHandle h) { mSet.insert(h); }
105  void StmtDFSet::remove(StmtHandle h) { mSet.erase(h); }
106 
107  bool StmtDFSet::handleInSet(StmtHandle h) { return (mSet.find(h)!=mSet.end()); }
108 
109  bool StmtDFSet::empty() { return mSet.empty(); }
110 
111  } // end of DataFlow namespace
112 } // end of OA namespace
113 */