1 #ifndef INTRA_PROC_ALIAS_ANALYSIS_H
2 #define INTRA_PROC_ALIAS_ANALYSIS_H
7 #include <boost/foreach.hpp>
8 #include <boost/shared_ptr.hpp>
9 #include <boost/unordered_map.hpp>
12 #define foreach BOOST_FOREACH
13 #define reverse_foreach BOOST_REVERSE_FOREACH
16 using namespace boost;
32 return (this->var == that.
var && this->derefLevel == that.
derefLevel);
78 virtual void computeAliases (
SgVariableSymbol *var,
int derefLevel, vector<SgGraphNode *> &) = 0;
81 virtual void computeAliases (
SgGraphNode *node,
int derefLevel, vector<SgGraphNode *> &) = 0;
90 virtual unsigned long getHash()
const = 0;
98 virtual void toDot(
const std::string& file_name) = 0;
135 void processNodes(std::ostream & o,
SgGraphNode* n, std::set<SgGraphNode*>& explored);
156 unsigned long getHash()
const {
return hash; }
165 void computeAliases (
SgVariableSymbol *var,
int derefLevel, vector<SgGraphNode *> &nodes);
168 void computeAliases (
SgGraphNode *node,
int derefLevel, vector<SgGraphNode *> &);
186 void toDot(
const std::string& file_name);
192 boost::shared_ptr<CompReprBase>
ptr;
216 unordered_map<SgGraphNode *, CompReprPtr>
ins;
219 unordered_map<SgGraphNode *, CompReprPtr>
outs;
225 unordered_map<SgGraphNode *, std::vector <std::pair<AliasRelationNode, AliasRelationNode> > >
aliasRelations;
246 std::vector <std::pair<AliasRelationNode, AliasRelationNode> > getAliasRelations(
SgGraphNode *node);
249 void addNewAliasRelation(
SgGraphNode *node, std::pair<AliasRelationNode, AliasRelationNode> a_relation) ;
259 namespace ProcessExpression {
285 void recursiveCollect(
SgGraphNode *, unordered_map<SgGraphNode*, CollectAliasRelations::COLOR> &);
320 virtual void buildCFG() ;
323 boost::unordered_map<SgFunctionDeclaration *, IntraProcAliasAnalysis *> &
mapping;
326 boost::unordered_map<SgExpression*, std::vector<SgFunctionDeclaration*> > &
resolver;
331 std::vector <std::pair<AliasRelationNode, AliasRelationNode> > &arg_relations,
332 std::vector <std::pair<AliasRelationNode, AliasRelationNode> > &return_relations);
336 std::vector <std::pair<AliasRelationNode, AliasRelationNode> > &arg_relations );
350 boost::unordered_map<SgFunctionDeclaration *, IntraProcAliasAnalysis *> &mapping,
351 boost::unordered_map<
SgExpression*, std::vector<SgFunctionDeclaration*> > &resolver);
360 std::vector<AliasRelationNode>
getReturnStmts () {
return gen->getReturnStmts(); }
385 virtual std::vector<SgGraphNode *>
getAllNodes() {
return cfgNodes; }
388 virtual std::vector<SgGraphNode *> getPredecessors(
SgGraphNode *n);