LinearityMatrixStandard.hpp
Go to the documentation of this file.00001
00015
00016
00017
00018 #ifndef _LINEARITYMATRIX_H
00019 #define _LINEARITYMATRIX_H
00020
00021
00022
00023 #include <iostream>
00024 #include <map>
00025 #include <set>
00026 #include <list>
00027
00028
00029 #include "LinearityPair.hpp"
00030 #include "LinearityDepsSet.hpp"
00031
00032
00033 #include <OpenAnalysis/Utils/OA_ptr.hpp>
00034 #include <OpenAnalysis/Location/Locations.hpp>
00035 #include <OpenAnalysis/Linearity/Interface.hpp>
00036 #include <OpenAnalysis/OABase/Annotation.hpp>
00037 #include <OpenAnalysis/Utils/GenOutputTool.hpp>
00038 #include <OpenAnalysis/DataFlow/DataFlowSet.hpp>
00039
00041 namespace OA {
00042 namespace Linearity {
00043
00044
00045
00046
00047 class LinearityMatrix : public virtual DataFlow::DataFlowSet,
00048 public virtual Linearity::Interface,
00049 public virtual Annotation {
00050 public:
00051 LinearityMatrix() {
00052 mLMmap = new std::map<OA_ptr<Location> ,OA_ptr<std::set<OA_ptr<LinearityPair> > > >;
00053 }
00054
00055
00056
00057 LinearityMatrix(int num) {
00058 mLMmap = new std::map<OA_ptr<Location> ,OA_ptr<std::set<OA_ptr<LinearityPair> > > >;
00059 }
00060
00061
00062
00063
00064
00065 LinearityMatrix(const LinearityMatrix &other) {
00066 mLMmap = new std::map<OA_ptr<Location> ,OA_ptr<std::set<OA_ptr<LinearityPair> > > >;
00067
00068 std::map<OA_ptr<Location> ,OA_ptr<std::set<OA_ptr<LinearityPair> > > >::iterator mapIter;
00069 mapIter = other.mLMmap->begin();
00070 for (; mapIter!=other.mLMmap->end(); mapIter++) {
00071 OA_ptr<Location> loc = mapIter->first;
00072 OA_ptr<std::set<OA_ptr<LinearityPair> > > lpSet = mapIter->second;
00073 OA_ptr<std::set<OA_ptr<LinearityPair> > > cplpSet;
00074 cplpSet = new std::set<OA_ptr<LinearityPair> >;
00075 std::set<OA_ptr<LinearityPair> >::iterator setIter;
00076 setIter = lpSet->begin();
00077 for (; setIter!=lpSet->end(); setIter++) {
00078 OA_ptr<LinearityPair> lp = *setIter;
00079 OA_ptr<LinearityPair> cplp;
00080 cplp = new LinearityPair(lp->getVar1(),lp->getVar2(),lp->getLClass());
00081 cplpSet->insert(cplp);
00082 }
00083 (*mLMmap)[loc]=cplpSet;
00084 }
00085
00086
00087 }
00088
00089
00090
00091
00092
00093 OA_ptr<LinearityPairIterator> getPairIteratorForVar( OA_ptr<Location> v );
00094
00095 void putLPSet(OA_ptr<Location> v, OA_ptr<std::set<OA_ptr<LinearityPair> > >lpSet);
00096
00097 void putLPair(OA_ptr<LinearityPair> lp);
00098
00099 OA_ptr<DataFlow::DataFlowSet> clone();
00100
00101
00102
00103
00104
00105 OA_ptr<LinearityMatrix> meet( OA_ptr<LinearityMatrix> other, IRHandlesIRInterface& pIR );
00106 OA_ptr<LinearityMatrix> meet( DataFlowSet &other, IRHandlesIRInterface& pIR );
00107
00108
00109
00110
00111
00112 void putDepsSet(OA_ptr<Location> v, OA_ptr<LinearityDepsSet> deps);
00113
00114
00115
00116
00117
00118
00119
00120
00121 OA_ptr<LinearityDepsSet> getDepsSet(OA_ptr<Location> v);
00122
00123
00124 OA_ptr<std::map<OA_ptr<Location> ,OA_ptr<std::set<OA_ptr<LinearityPair> > > > > getMap();
00125
00126 void output();
00127
00128 void output(IRHandlesIRInterface& pIR);
00129
00130 void dump(std::ostream &os) {}
00131
00132 void dump(std::ostream& os, OA_ptr<IRHandlesIRInterface> ir);
00133
00134
00135 LinearityMatrix& operator=(const LinearityMatrix& other);
00136
00137 bool operator ==(DataFlow::DataFlowSet &other) const;
00138
00139 bool operator !=(DataFlow::DataFlowSet &other) const;
00140
00141 bool operator ==(const LinearityMatrix& other) const;
00142
00143 private:
00144
00145 OA_ptr<std::map<OA_ptr<Location> ,OA_ptr<std::set<OA_ptr<LinearityPair> > > > > mLMmap;
00146 std::map<OA_ptr<Location> ,OA_ptr<std::set<OA_ptr<LinearityPair> > > >::iterator mIter;
00147
00148 };
00149
00150 }
00151 }
00152
00153
00154 #endif
00155