Program Listing for File PtrAliasAnalysis.h#
↰ Return to documentation for file (src/midend/programAnalysis/VirtualFunctionAnalysis/PtrAliasAnalysis.h)
#ifndef PTR_ALIAS_ANALYSIS
#define PTR_ALIAS_ANALYSIS
#include "ClassHierarchyGraph.h"
#include "InterProcDataFlowAnalysis.h"
#include "IntraProcAliasAnalysis.h"
using namespace std;
class ROSE_DLL_API PtrAliasAnalysis : public InterProcDataFlowAnalysis{
protected:
SgIncidenceDirectedGraph *callGraph;
std::unordered_map<SgFunctionDeclaration *, IntraProcAliasAnalysis *> intraAliases;
std::unordered_map<SgExpression *, std::vector<SgFunctionDeclaration*> > resolver;
ClassHierarchyWrapper *classHierarchy;
CallGraphBuilder *cgBuilder;
public:
enum COLOR {WHITE=0, GREY, BLACK};
enum TRAVERSAL_TYPE {TOPOLOGICAL=0, REVERSE_TOPOLOGICAL};
PtrAliasAnalysis(SgProject *__project);
~PtrAliasAnalysis();
void run();
void getFunctionDeclarations(std::vector<SgFunctionDeclaration*> &);
bool runAndCheckIntraProcAnalysis(SgFunctionDeclaration *);
private:
void SortCallGraphRecursive(SgFunctionDeclaration* targetFunction, SgIncidenceDirectedGraph* callGraph,
std::unordered_map<SgFunctionDeclaration*, SgGraphNode*> &graphNodeToFunction, std::unordered_map<SgGraphNode*,
PtrAliasAnalysis::COLOR> &colors, std::vector<SgFunctionDeclaration*> &processingOrder,
PtrAliasAnalysis::TRAVERSAL_TYPE order) ;
void SortCallGraphNodes(SgFunctionDeclaration* targetFunction, SgIncidenceDirectedGraph* callGraph,
std::unordered_map<SgFunctionDeclaration*, SgGraphNode*> &graphNodeToFunction,
std::vector<SgFunctionDeclaration*> &processingOrder, PtrAliasAnalysis::TRAVERSAL_TYPE order);
void computeCallGraphNodes(SgFunctionDeclaration* targetFunction, SgIncidenceDirectedGraph* callGraph,
std::vector<SgFunctionDeclaration*> &processingOrder, PtrAliasAnalysis::TRAVERSAL_TYPE order);
// Order of performing Dataflow Analysis
TRAVERSAL_TYPE order;
};
#endif