1#include <featureTests.h>
2#ifdef ROSE_ENABLE_SOURCE_ANALYSIS
7#include "genericDataflowCommon.h"
23extern std::map<SgFunctionDefinition*, std::set<varID> > allVars;
24extern std::map<SgFunctionDefinition*, std::set<varID> > activeVars;
44 virtual std::string str()
const = 0;
46 virtual bool operator == (
const variable &that)
const = 0;
47 virtual bool operator < (
const variable &that)
const = 0;
56 virtual bool isGlobal()
const=0;
65 std::vector<SgInitializedName *> components;
67 std::map<std::string, void*> annotations;
74 varID(std::string name)
91 bool ret = init(name);
111 bool init(
const varID& that);
124 void operator = (
const variable &that);
128 bool collectDotComponents(
const SgDotExp* dotExp);
140 SgExpression* toSgExpression_rec(std::vector<SgInitializedName *>::const_iterator rest)
const;
144 static bool isValidVarExp(
const SgNode* exp);
156 bool addAnnotation(
const std::string& aName,
void* annot);
160 bool remAnnotation(
const std::string& aName);
164 bool remAllAnnotations();
171 bool swapAnnotations(
const std::string& fromAnnotName,
void* fromAnnotVal,
172 const std::string& toAnnotName,
void* toAnnotVal);
175 void* getAnnotation(
const std::string& aName)
const;
178 bool hasAnnotation(
const std::string& aName)
const;
181 bool hasAnyAnnotation(
const std::set<std::string>& aNames)
const;
184 bool hasAllAnnotations(
const std::set<std::string>& aNames)
const;
187 int numAnnotations()
const;
190 const std::map<std::string, void*>& getAnnotations()
const;
197 bool equal(
const varID& two)
const;
198 bool lessThan(
const varID& two)
const;
200 bool operator == (
const variable &that)
const;
201 bool operator != (
const varID &that)
const;
202 bool operator < (
const variable &that)
const;
203 bool operator > (
const varID &that)
const;
204 bool operator <= (
const varID &that)
const;
205 bool operator >= (
const varID &that)
const;
214 std::string str()
const;
215 std::string str(
bool noAnnot)
const;
220 std::string str_linenum()
const;
225 std::string str_ptr()
const;
232 bool isArrayType()
const;
235 bool isCompilerGenerated()
const;
238 bool isGlobal()
const;
248 static long globalMaxID;
259std::ostream &operator<<(std::ostream &stream,
varID v);
260std::ostream &operator<<(std::ostream &stream,
const std::set<varID>::iterator& v);
280typedef std::set<varID, std::less<varID> > varIDSet;
281typedef std::map<varID, varIDSet *> m_varID2setPtr;
282typedef std::map<varID, quad> m_varID2quad;
283typedef std::map<varID, std::string> m_varID2str;
284typedef std::map<varID, bool> m_varID2bool;
285typedef std::pair<varID, varID> varIDpair;
286typedef std::list<varID> varIDlist;
287typedef std::map<varID, m_varID2quad> m_varID2varID2quad;
290typedef std::set<quad, std::less<quad> > setQuad;
291typedef std::map<quad, setQuad *> m_quad2setPtr;
310void addPredefinedVars(varIDSet &vars);
313bool existsVariable(
varID x, m_varID2str &vars2Name );
316bool existsVariable(
SgVarRefExp *x, m_varID2str &vars2Name );
319bool isTypeConsidered(
SgNode * exp);
337varIDSet getVarRefsInSubtree(
SgNode* root);
341varIDSet getReadVarRefsInSubtree(
SgNode* root);
345varIDSet getWriteVarRefsInSubtree(
SgNode* root);
349varIDSet getArrayVarRefsInSubtree(
SgNode* root);
355 std::list<SgExpression*>* indexExprs;
362 std::string str()
const;
364 bool operator == (
const variable &that_arg)
const;
366 bool operator < (
const variable &that)
const;
376 const varID& getArrayVar();
379 std::list<SgExpression*>* getIndexExprs();
387 SgPntrArrRefExp* toSgExpression_rec(std::list<SgExpression*>::reverse_iterator itIndexes)
const;
391 bool isGlobal()
const;
396std::set<arrayElt> getArrayRefsInSubtree(
SgNode* root);
This class represents the notion of an expression. Expressions are derived from SgLocatedNodes,...
This class represents the notion of a declared variable.
This class represents the base class for all IR nodes within Sage III.
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope,...
This class represents the base class for all types.
This class represents the variable refernece in expressions.