LinearityDepsSet.hpp

Go to the documentation of this file.
00001 
00015 //--------------------------------------------------------------------
00016 //--------------------------------------------------------------------
00017 
00018 #ifndef _LINEARITYDEP_H
00019 #define _LINEARITYDEP_H
00020 
00021 //--------------------------------------------------------------------
00022 // STL headers
00023 #include <iostream>
00024 #include <map>
00025 #include <set>
00026 #include <list>
00027 
00028 // Local headers
00029 #include "LinearityPair.hpp"
00030 
00031 //OpenAnalysis headers
00032 #include <OpenAnalysis/Utils/OA_ptr.hpp>
00033 #include <OpenAnalysis/OABase/Annotation.hpp>
00034 #include <OpenAnalysis/Location/Locations.hpp>
00035 
00037 namespace OA {
00038   namespace Linearity {
00039 
00040 //***********************************************
00041 // Sets Starts
00042 //***********************************************
00043 
00044 class LinearityDepsSet : public virtual Annotation{
00045     private:
00046         //<v,class>
00047         //A list of the VarClassPair <v,class> that we have.
00048         OA_ptr<std::set<OA_ptr<VarClassPair> > > vcSet;
00049         std::set<OA_ptr<VarClassPair> >::iterator mIter;
00050     public:
00051         LinearityDepsSet();
00052         /* k -> { <v,T> | v E V } */
00053         LinearityDepsSet(double);
00054 
00055         /* v -> { <v,linear> } U { < w,class> | <<v,w>,class> E IN(b) */
00056         LinearityDepsSet(OA_ptr<Location> v, OA_ptr<LinearityDepsSet> deps);
00057 
00058         /* e1(* /)e2 -> {<v,nonlinear> | <v,class> E DEPS(e1) OR <v,class> E DEPS(e2) */
00059         OA_ptr<LinearityDepsSet> multdiv(OA_ptr<LinearityDepsSet> deps); 
00060 
00061         /* e1(+ -)e2 -> {<v1,(class1 meet class2)> */
00062         OA_ptr<LinearityDepsSet> addsub(OA_ptr<LinearityDepsSet> deps); 
00063 
00064         /* function(v) -> {<v,nonlinear>} */
00065         OA_ptr<LinearityDepsSet> func(OA_ptr<LinearityDepsSet> deps);
00066         
00067         /* e1^1 -> {<v1,(linear meet class)> | <v,class> E DEPS(e1) */
00068         OA_ptr<LinearityDepsSet> power1(OA_ptr<LinearityDepsSet> deps);
00069         
00070         /* e1^k -> {<v1,(nonlinear meet class)> | <v,class> E DEPS(e1) */
00071         OA_ptr<LinearityDepsSet> powerk(OA_ptr<LinearityDepsSet> deps);
00072         
00073         /* e1 anyop k -> {<v1,(linear meet class)> | <v,class> E DEPS(e1) */
00074         OA_ptr<LinearityDepsSet> anyopk(); 
00075 
00076         /* general linear definition -> {<v1,(linear meet class)> | <v,class> E DEPS(e1) */
00077         OA_ptr<LinearityDepsSet> linear();
00078 
00079         /* general nonlinear definition -> 
00080          * {<v1,(nonlinear meet class)> | <v,class> E DEPS(e1) */
00081         OA_ptr<LinearityDepsSet> nonlinear();
00082 
00083         // meet operation between two LinearityDepsSet objects
00084         OA_ptr<LinearityDepsSet> meet( OA_ptr<LinearityDepsSet> other );
00085         
00086         void insert(OA_ptr<VarClassPair> vcp);
00087         void erase(OA_ptr<VarClassPair> vcp);
00088         
00089         // all vars and their classes that we have info on
00090         OA_ptr<VarClassPairIterator> getVarClassPairIterator();
00091         
00092         OA_ptr<std::set<OA_ptr<VarClassPair> > > getSet();
00093 
00094         void output(IRHandlesIRInterface& ir);
00095         
00096         //Converts all Current VarClassPairs in this instance into 
00097         //LinearityPairs with *v being its first argument 
00098         OA_ptr<std::set<OA_ptr<LinearityPair> > >convertToLinearityPair(OA_ptr<Location> v);
00099 
00100         OA_ptr<LinearityDepsSet> operator=( OA_ptr<LinearityDepsSet> other );
00101         LinearityDepsSet& operator=(const LinearityDepsSet& other);
00102 };
00103 
00104   } // end of namespace Linearity
00105 } // end of namespace OA
00106 
00107 #endif
00108