Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages
Path Class Reference#include <path.h>
Inheritance diagram for Path:
List of all members.
|
Public Types |
enum | LocationKind { Statement,
BasicBlock,
Procedure
} |
| Kind of location. More...
|
Public Member Functions |
| Path (PathDB *db, const Path *parent, procNode *callee) |
| Path (PathDB *db, const Path *parent, procNode *callee, basicblockNode *block) |
| Path (PathDB *db, const Path *parent, const Location &loc) |
| Path (const Path &other) |
| ~Path () |
const Path * | parent () const |
int | depth () const |
bool | dominates_exit () const |
bool | is_recursive () const |
bool | is_proc_present (procNode *proc) const |
bool | is_always () const |
void | print_shallow (ostream &o) const |
void | print_deep (ostream &o) const |
void | visit () |
| Visit.
|
void | finish () |
| Finish.
|
virtual void | adjust_depth ()=0 |
| Adjust depths.
|
virtual void | print (ostream &o) const=0 |
virtual void | print_path (ostream &o) const=0 |
|
LocationKind | kind () const |
unsigned int | subtree_id () const |
Location * | dominator () const |
void | set_dominator (Location *d) |
void | clear_dominator () |
int | num_children () const |
void | increment_children () |
void | decrement_children () |
unsigned int | tree_min () const |
void | set_tree_min (unsigned int m) |
unsigned int | tree_max () const |
void | set_tree_max (unsigned int m) |
Static Public Member Functions |
const Path * | always () |
bool | dominates (const Location *dom, const Location *cur) |
| Interprocedure dominance test.
|
bool | strictly_dominates (const Location *dom, const Location *cur) |
| Interprocedure strict dominance test.
|
procLocation * | procedure (Location *where) |
| Find the enclosing procedure.
|
bool | is_prefix (const Location *prefix, const Location *longer) |
| See if one location is a prefix of the other.
|
void | stats () |
Static Public Attributes |
|
unsigned int | stmt_count = 0 |
unsigned int | block_count = 0 |
unsigned int | proc_count = 0 |
unsigned int | dom_calls = 0 |
Static Protected Member Functions |
unsigned int | next_tree_number () |
| Get the next tree number.
|
Protected Attributes |
unsigned int | _kind:2 |
| The kind of location.
|
unsigned int | _subtree_id:16 |
| Subtree ID.
|
unsigned int | _num_children:8 |
| Number of dominator children.
|
Location * | _dominator |
| Immediate dominator.
|
|
unsigned int | _tree_min |
unsigned int | _tree_max |
Static Protected Attributes |
unsigned int | current_subtree_id = 0 |
| Global subtree ID counter.
|
unsigned int | current_tree_number = 0 |
| The current tree number to assign.
|
Private Member Functions |
| Path () |
Private Attributes |
const Path * | _parent |
| Parent.
|
int | _depth |
bool | _dominates_exit |
PathDB * | _db |
Static Private Attributes |
const Path * | Always = new Path() |
Friends |
class | PathDB |
ostream & | operator<< (ostream &o, const Path &c) |
ostream & | operator<< (ostream &o, const Location &loc) |
Member Enumeration Documentation
enum Location::LocationKind [inherited]
|
|
|
Kind of location.
- Enumeration values:
-
Statement |
|
BasicBlock |
|
Procedure |
|
Definition at line 93 of file location.h. |
Constructor & Destructor Documentation
Path::Path |
( |
const Path & |
other |
) |
|
|
Member Function Documentation
virtual void Location::adjust_depth |
( |
|
) |
[pure virtual, inherited] |
|
const Path* Path::always |
( |
|
) |
[inline, static] |
|
void Location::clear_dominator |
( |
|
) |
[inherited] |
|
void Location::decrement_children |
( |
|
) |
[inline, inherited] |
|
int Path::depth |
( |
|
) |
const [inline] |
|
bool Location::dominates |
( |
const Location * |
dom, |
|
|
const Location * |
cur |
|
) |
[static, inherited] |
|
bool Path::dominates_exit |
( |
|
) |
const [inline] |
|
Location* Location::dominator |
( |
|
) |
const [inline, inherited] |
|
void Location::finish |
( |
|
) |
[inherited] |
|
void Location::increment_children |
( |
|
) |
[inline, inherited] |
|
bool Path::is_always |
( |
|
) |
const [inline] |
|
bool Location::is_prefix |
( |
const Location * |
prefix, |
|
|
const Location * |
longer |
|
) |
[static, inherited] |
|
bool Path::is_proc_present |
( |
procNode * |
proc |
) |
const |
|
bool Path::is_recursive |
( |
|
) |
const |
|
unsigned int Location::next_tree_number |
( |
|
) |
[inline, static, protected, inherited] |
|
int Location::num_children |
( |
|
) |
const [inline, inherited] |
|
const Path* Path::parent |
( |
|
) |
const [inline] |
|
virtual void Location::print |
( |
ostream & |
o |
) |
const [pure virtual, inherited] |
|
void Path::print_deep |
( |
ostream & |
o |
) |
const [inline] |
|
virtual void Location::print_path |
( |
ostream & |
o |
) |
const [pure virtual, inherited] |
|
void Path::print_shallow |
( |
ostream & |
o |
) |
const [inline] |
|
|
Find the enclosing procedure.
Definition at line 395 of file location.cc.
References Location::BasicBlock, stmtLocation::block_location(), Location::kind(), basicblockLocation::proc_location(), Location::Procedure, and Location::Statement.
Referenced by Pointers::compute_accuracy(), memoryModel::create_memory_object(), Pointers::determine_call_targets(), Pointers::eval(), memoryModel::lookup(), and memoryBlock::name(). |
void Location::set_dominator |
( |
Location * |
d |
) |
[inherited] |
|
void Location::set_tree_max |
( |
unsigned int |
m |
) |
[inline, inherited] |
|
void Location::set_tree_min |
( |
unsigned int |
m |
) |
[inline, inherited] |
|
void Location::stats |
( |
|
) |
[static, inherited] |
|
bool Location::strictly_dominates |
( |
const Location * |
dom, |
|
|
const Location * |
cur |
|
) |
[static, inherited] |
|
unsigned int Location::subtree_id |
( |
|
) |
const [inline, inherited] |
|
unsigned int Location::tree_max |
( |
|
) |
const [inline, inherited] |
|
unsigned int Location::tree_min |
( |
|
) |
const [inline, inherited] |
|
void Location::visit |
( |
|
) |
[inherited] |
|
Friends And Related Function Documentation
ostream& operator<< |
( |
ostream & |
o, |
|
|
const Location & |
loc |
|
) |
[friend, inherited] |
|
ostream& operator<< |
( |
ostream & |
o, |
|
|
const Path & |
c |
|
) |
[friend] |
|
friend class PathDB [friend]
|
|
Member Data Documentation
int Path::_depth [private]
|
|
bool Path::_dominates_exit [private]
|
|
Location* Location::_dominator [protected, inherited]
|
|
unsigned int Location::_kind [protected, inherited]
|
|
|
The kind of location.
There are only three kinds, so we only need two bits.
Definition at line 129 of file location.h.
Referenced by Location::kind(). |
unsigned int Location::_num_children [protected, inherited]
|
|
|
Number of dominator children.
This is the number of locations immediately dominated by this one. We use this number to control the depth-first tree numbering algorithm. When the number is greater than one, we know that we still have dominator subtrees to number. Each time we finish a subtree, we decrement this number on the immediate dominator. When it reaches zero, the whole subtree is numbered.
We limit this field to 8 bits, which only allows a node to immediately dominate 256 other nodes. This is probably way higher than it needs to be, but we'll play it safe.
Definition at line 170 of file location.h.
Referenced by Location::decrement_children(), Location::increment_children(), and Location::num_children(). |
const Path* Path::_parent [private]
|
|
|
Parent.
A pointer to the containing location (strictly in terms of program structure). For stmtLocations, this points to the containing basic block. For basicblockLocations, it points to the procLocation. For procLocations, it points to the callsite stmtLocation (if there is one).
Reimplemented from Location.
Definition at line 117 of file path.h.
Referenced by Path(). |
unsigned int Location::_subtree_id [protected, inherited]
|
|
unsigned int Location::_tree_max [protected, inherited]
|
|
unsigned int Location::_tree_min [protected, inherited]
|
|
|
Tree numbering
These two numbers implement the tree numbering scheme (from communication from Mark Wegman) that allows a constant time interprocedural dominance test. The scheme works as follows: we perform a depth-first traversal of the dominator tree, both pre-order and post-order, assigning consecutive numbers to "tree min" value on the way down, and the "tree max" value on the way up.
This numbering results in the following invariant: the min-max range of each node contains the min-max ranges of all nodes that it dominates.
Since we compute this numbering on-line, we need to test dominance for nodes on the way down the tree. This means we have to do without a tree max value in some cases. Therefore, we have a special case: the tree max defaults to MAX_INT until it is given a specific value.
These number can get large, so we use full 32-bit ints (limits us to 4 billion program locations).
Definition at line 203 of file location.h. |
const Path * Path::Always = new Path() [static, private]
|
|
unsigned int Location::block_count = 0 [static, inherited]
|
|
unsigned int Location::current_subtree_id = 0 [static, protected, inherited]
|
|
unsigned int Location::current_tree_number = 0 [static, protected, inherited]
|
|
unsigned int Location::dom_calls = 0 [static, inherited]
|
|
unsigned int Location::proc_count = 0 [static, inherited]
|
|
unsigned int Location::stmt_count = 0 [static, inherited]
|
|
The documentation for this class was generated from the following files:
|