Code Listener
[unstable] git snapshot
|
Data Structures | |
class | Item |
class | Node |
class | Graph |
class | GlobalData |
class | BuildCtx |
Typedefs | |
typedef std::vector< const Item * > | TItemList |
typedef std::set< Node * > | TNodeList |
typedef std::map< int, Node * > | TMap |
typedef std::pair< Node *, Node * > | TNodePair |
typedef std::vector< TNodePair > | TNodeJoinTodo |
Enumerations | |
enum | ItemCodeE { PT_ITEM_VAR = 0, PT_ITEM_RET, PT_ITEM_MALLOC } |
Functions | |
bool | isDead (const GlobalData &) |
void | plotGraph (const Storage &stor, const std::string &filename="pointsto") |
void | joinNodesS (BuildCtx &ctx, Graph &ptg, Node *nodeA, Node *nodeB) |
Join two nodes: nodeA = nodeA JOIN nodeB. More... | |
void | joinFixPointS (BuildCtx &ctx, Graph &ptg) |
Start the merging of nodes based on ctx.joinTodo information. More... | |
Node * | preventEndingS (Node *node) |
allocate and append one (empty) successor for node if it has not other output. More... | |
void | appendNodeS (BuildCtx &ctx, Graph &ptg, Node *parent, Node *which) |
Append (even existing) node to other one as a successor. More... | |
Node * | nodeAccessS (const CodeStorage::Storage &stor, Graph &ptg, const cl_operand &op, bool *referenced=NULL) |
Find or create node of graph based on whole information provided by some operand. More... | |
Node * | appendEmptyS (Node *root) |
Similar to preventEndingS() except that it would fail if the single output already existed. More... | |
const Node * | hasOutputS (const Node *node) |
Return non-modifiable output node pointer if the output of 'node' exists. More... | |
Node * | getOutputS (Node *node) |
Return modifiable output node pointer if the output of 'node' exists. More... | |
Node * | goDownS (Node *start, int steps) |
go 'steps'-times downwards in node's graph. More... | |
void | bindItem (Graph &ptg, Node *n, const Item *) |
This is blind function – it does exactly what we want from it. More... | |
bool | bindVarList (BuildCtx &ctx, Graph &ptg, Node *target, const TItemList &nl) |
bindVarList is more sophisticated function than 'bindVar'. More... | |
bool | follows (const Graph &ptg, const Var *varA, const Var *varB) |
return true if some variable (lhs) follows another one (rhs) More... | |
bool | followsGlobal (const CodeStorage::Storage &stor, const Var *lVar, const Var *rVar) |
bool | isPointed (const Graph *ptg, const Var *v) |
return true if given variable 'v' is pointed in given graph 'ptg' More... | |
bool | isPointedGlob (const CodeStorage::Storage &stor, const Var *v) |
return true if the given variable 'v' is pointed in any points-to graph More... | |
Node * | getNode (Graph &ptg, const Var *v) |
find (or create if doesn't exist!) node for given variable More... | |
Node * | getNode (Graph &ptg, const cl_operand &op) |
Node * | getNode (Graph &ptg, const Item *i) |
Node * | nodeFromForeign (Graph &ptg, const Item *i) |
find or create node based on item from foreign graph More... | |
Node * | allocNodeForItem (Graph &, const Item *i) |
allocate new node and bind i with this new node More... | |
const Node * | existsUid (const Graph &graph, int uid) |
return the node pointer according to passed 'uid' of variable or function. More... | |
const Node * | existsVar (const Graph &graph, const Var *v) |
return pointer to node with given variable 'v' More... | |
const Node * | existsItem (const Graph &graph, const Item *i) |
Node * | findNode (Graph &, int) |
return pointer to (modifiable) node object according to given variable or node item pointer. More... | |
Node * | findNode (Graph &, const Var *) |
Node * | findNode (Graph &, const Item *) |
void | setBlackHole (Graph &, Node *) |
Setup the given node to be black-hole – self-pointed node that eats each other note that is set as its successor. More... | |
void | addEdge (Node *from, Node *to) |
Interconnect two given nodes with edge. More... | |
bool | existsError (const Storage &stor) |
return true when some problem occurs More... | |
bool | runFICS (BuildCtx &ctx) |
Definition at line 658 of file storage.hh.
Definition at line 682 of file storage.hh.
typedef std::vector<TNodePair> TNodeJoinTodo |
Definition at line 43 of file pointsto.hh.
Definition at line 659 of file storage.hh.
Definition at line 42 of file pointsto.hh.
enum ItemCodeE |
Enumerator | |
---|---|
PT_ITEM_VAR | |
PT_ITEM_RET | |
PT_ITEM_MALLOC |
Definition at line 622 of file storage.hh.
void CodeStorage::PointsTo::addEdge | ( | Node * | from, |
Node * | to | ||
) |
Interconnect two given nodes with edge.
Node* CodeStorage::PointsTo::allocNodeForItem | ( | Graph & | , |
const Item * | i | ||
) |
allocate new node and bind i with this new node
Node* CodeStorage::PointsTo::appendEmptyS | ( | Node * | root) |
Similar to preventEndingS() except that it would fail if the single output already existed.
void CodeStorage::PointsTo::appendNodeS | ( | BuildCtx & | ctx, |
Graph & | ptg, | ||
Node * | parent, | ||
Node * | which | ||
) |
Append (even existing) node to other one as a successor.
Note that this just add pair to ctx.joinTodo – this requires to call joinFixPointS to do the real joining part.
void CodeStorage::PointsTo::bindItem | ( | Graph & | ptg, |
Node * | n, | ||
const Item * | |||
) |
This is blind function – it does exactly what we want from it.
Even if the given item 'i' already existed somewhere in the graph it will bind the item (as a referenced duplicate) into the node 'n'
bool CodeStorage::PointsTo::bindVarList | ( | BuildCtx & | ctx, |
Graph & | ptg, | ||
Node * | target, | ||
const TItemList & | nl | ||
) |
bindVarList is more sophisticated function than 'bindVar'.
Before it assigns some variable item to the node it checks whether this item does not already exist somewhere else in target graph. If yes, it performs joining (joinFixPointS()) with the concurrent node.
bool CodeStorage::PointsTo::existsError | ( | const Storage & | stor) |
return true when some problem occurs
const Node* CodeStorage::PointsTo::existsItem | ( | const Graph & | graph, |
const Item * | i | ||
) |
const Node* CodeStorage::PointsTo::existsUid | ( | const Graph & | graph, |
int | uid | ||
) |
return the node pointer according to passed 'uid' of variable or function.
const Node* CodeStorage::PointsTo::existsVar | ( | const Graph & | graph, |
const Var * | v | ||
) |
return pointer to node with given variable 'v'
Node* CodeStorage::PointsTo::findNode | ( | Graph & | , |
int | |||
) |
return pointer to (modifiable) node object according to given variable or node item pointer.
Return NULL when the node doesn't exist.
Node* CodeStorage::PointsTo::findNode | ( | Graph & | , |
const Var * | |||
) |
Node* CodeStorage::PointsTo::findNode | ( | Graph & | , |
const Item * | |||
) |
bool CodeStorage::PointsTo::follows | ( | const Graph & | ptg, |
const Var * | varA, | ||
const Var * | varB | ||
) |
return true if some variable (lhs) follows another one (rhs)
bool CodeStorage::PointsTo::followsGlobal | ( | const CodeStorage::Storage & | stor, |
const Var * | lVar, | ||
const Var * | rVar | ||
) |
Node* CodeStorage::PointsTo::getNode | ( | Graph & | ptg, |
const Var * | v | ||
) |
find (or create if doesn't exist!) node for given variable
Node* CodeStorage::PointsTo::getNode | ( | Graph & | ptg, |
const cl_operand & | op | ||
) |
Node* CodeStorage::PointsTo::getNode | ( | Graph & | ptg, |
const Item * | i | ||
) |
Node* CodeStorage::PointsTo::getOutputS | ( | Node * | node) |
Return modifiable output node pointer if the output of 'node' exists.
Return NULL if the given node does not have an output.
Node* CodeStorage::PointsTo::goDownS | ( | Node * | start, |
int | steps | ||
) |
go 'steps'-times downwards in node's graph.
Pre-allocate non-existing nodes when needed. Note that the cycles are not detected – when you go down in a loop no node will be allocated. Return the desired node pointer.
const Node* CodeStorage::PointsTo::hasOutputS | ( | const Node * | node) |
Return non-modifiable output node pointer if the output of 'node' exists.
Return NULL if the given node does not have an output.
bool CodeStorage::PointsTo::isDead | ( | const GlobalData & | ) |
bool CodeStorage::PointsTo::isPointed | ( | const Graph * | ptg, |
const Var * | v | ||
) |
return true if given variable 'v' is pointed in given graph 'ptg'
bool CodeStorage::PointsTo::isPointedGlob | ( | const CodeStorage::Storage & | stor, |
const Var * | v | ||
) |
return true if the given variable 'v' is pointed in any points-to graph
void CodeStorage::PointsTo::joinFixPointS | ( | BuildCtx & | ctx, |
Graph & | ptg | ||
) |
Start the merging of nodes based on ctx.joinTodo information.
This function uses joinNodesS() internally.
void CodeStorage::PointsTo::joinNodesS | ( | BuildCtx & | ctx, |
Graph & | ptg, | ||
Node * | nodeA, | ||
Node * | nodeB | ||
) |
Join two nodes: nodeA = nodeA JOIN nodeB.
This must always KEEP nodeA on the same place as-is (it may be referenced by others) but nodeB is going to be deleted completely (there must be guaranteed that nobody is pointing it before this operation).
Node* CodeStorage::PointsTo::nodeAccessS | ( | const CodeStorage::Storage & | stor, |
Graph & | ptg, | ||
const cl_operand & | op, | ||
bool * | referenced = NULL |
||
) |
Find or create node of graph based on whole information provided by some operand.
Dereferences, field accesses, etc. are taken into account.
stor | reference to the related intermediate code representation |
ptg | reference to the points-to graph being built |
op | an operand to take the information from |
referenced | is set to true when the '&' reference operator was detected in operand. |
Node* CodeStorage::PointsTo::nodeFromForeign | ( | Graph & | ptg, |
const Item * | i | ||
) |
find or create node based on item from foreign graph
void CodeStorage::PointsTo::plotGraph | ( | const Storage & | stor, |
const std::string & | filename = "pointsto" |
||
) |
Node* CodeStorage::PointsTo::preventEndingS | ( | Node * | node) |
allocate and append one (empty) successor for node if it has not other output.
bool CodeStorage::PointsTo::runFICS | ( | BuildCtx & | ctx) |
void CodeStorage::PointsTo::setBlackHole | ( | Graph & | , |
Node * | |||
) |
Setup the given node to be black-hole – self-pointed node that eats each other note that is set as its successor.