ROSE
0.9.6a
|
To resolve virtual funcitons correctly we need to answer the question "What are the possible types that an object point to at a call site?" So we basically need to perform Pointer Aliasing Analysis. More...
#include <VirtualFunctionAnalysis.h>
Public Member Functions | |
VirtualFunctionAnalysis (SgProject *__project) | |
void | run () |
Function which actually performs the DataFlowAnalyis. More... | |
void | reset () |
DataFlow based Virtual function resolve technique is expensive. More... | |
void | pruneCallGraph (CallGraphBuilder &) |
Using the DataFlow based Virtual Function Analysis it prunes the call graph to generate more precise and accurate call graph. More... | |
void | resolveFunctionCall (SgExpression *, std::vector< SgFunctionDeclaration * > &) |
Given a Callsite(SgFunctionCallExp or SgConstructionInitializer) it resolves the function calls. More... | |
~VirtualFunctionAnalysis () | |
Public Member Functions inherited from PtrAliasAnalysis | |
PtrAliasAnalysis (SgProject *__project) | |
~PtrAliasAnalysis () | |
void | getFunctionDeclarations (std::vector< SgFunctionDeclaration * > &) |
Get the list of function declarations to perform interprocedural DataFlowAnalysis. More... | |
bool | runAndCheckIntraProcAnalysis (SgFunctionDeclaration *) |
Execute IntraProc Analysis and check whether something changed. More... | |
Public Member Functions inherited from InterProcDataFlowAnalysis | |
InterProcDataFlowAnalysis (SgProject *_project) | |
Private Attributes | |
bool | isExecuted |
Additional Inherited Members | |
Public Types inherited from PtrAliasAnalysis | |
enum | COLOR { WHITE =0, GREY, BLACK } |
Enum used for Topological sorting. More... | |
enum | TRAVERSAL_TYPE { TOPOLOGICAL =0, REVERSE_TOPOLOGICAL } |
Enum used for identifying traversal type. More... | |
Protected Attributes inherited from PtrAliasAnalysis | |
SgIncidenceDirectedGraph * | callGraph |
The stored callGraph for internal processing. More... | |
boost::unordered_map < SgFunctionDeclaration *, IntraProcAliasAnalysis * > | intraAliases |
A map from SgFunctionDeclaration to IntraProcAliasAnalysis. More... | |
boost::unordered_map < SgExpression *, std::vector < SgFunctionDeclaration * > > | resolver |
A map which stores the function call resolve information. More... | |
ClassHierarchyWrapper * | classHierarchy |
ClassHierarchy of the project. More... | |
CallGraphBuilder * | cgBuilder |
To resolve virtual funcitons correctly we need to answer the question "What are the possible types that an object point to at a call site?" So we basically need to perform Pointer Aliasing Analysis.
For this project we opted to do InterProcedural FlowSensitive DataFlow Analysis as described in
"Flow-Sensitive Interprocedural Type Analysis for C++”, TechReport ‘95 Paul Carini Harini Srinivasan
So we perform Pointer Alias Analysis and Virtual Function Analysis simultenously which in turn complements each other to be more precise. The basic idea is as follows:
Definition at line 42 of file VirtualFunctionAnalysis.h.
|
inline |
Definition at line 47 of file VirtualFunctionAnalysis.h.
|
inline |
Definition at line 68 of file VirtualFunctionAnalysis.h.
|
virtual |
Function which actually performs the DataFlowAnalyis.
Reimplemented from PtrAliasAnalysis.
void VirtualFunctionAnalysis::reset | ( | ) |
DataFlow based Virtual function resolve technique is expensive.
So it's memorized so that subsequent resolve calls can be answered. This function reset the memorization.
void VirtualFunctionAnalysis::pruneCallGraph | ( | CallGraphBuilder & | ) |
void VirtualFunctionAnalysis::resolveFunctionCall | ( | SgExpression * | , |
std::vector< SgFunctionDeclaration * > & | |||
) |
Given a Callsite(SgFunctionCallExp or SgConstructionInitializer) it resolves the function calls.
For Virtual Functions it returns the minimal set of functions that may be execute at runtime.
|
private |
Definition at line 44 of file VirtualFunctionAnalysis.h.