constantAnalyzer Class Reference#include <constants.h>
List of all members.
|
Public Member Functions |
| constantAnalyzer () |
| Create a new constant analysis.
|
| ~constantAnalyzer () |
| Destructor.
|
void | clear () |
| Clear.
|
void | set_null_object (memoryBlock *null_object) |
| Set the null object.
|
const constant * | top () const |
| TOP value.
|
const constant * | bottom () const |
| BOTTOM value.
|
bool | has_value (const constant *val) |
| Has value.
|
bool | has_truth_value (const constant *val, bool &value) |
| Check for truth value.
|
const constant * | lookup (const constant &value) |
| Lookup a constant value.
|
const constant * | lookup_flowvalue (memoryDef *def) |
| Lookup a variable value.
|
bool | update_flowvalue (const constant *val, memoryDef *def) |
| Update a variable value.
|
const constant * | meet (const constant *one, const constant *two) |
| Meet function.
|
const constant * | rebuild_flowvalue (pointerValue &pointer) |
| Rebuild the flow value.
|
void | record_expression (exprNode *expr, const constant *val) |
| Record the value of an expression.
|
void | record_stmt (stmtNode *stmt, const constant *val) |
| Record the rhs value of an threeAddr.
|
const constant * | evaluate_points_to (const memoryblock_set &points_to) |
| Evaluate points-to set.
|
const constant * | lookup_expression (exprNode *expr) |
| Look up an expression.
|
const constant * | lookup_stmt (stmtNode *expr) |
void | at_id (stmtLocation *current, idNode *id, pointerValue &value) |
void | at_unary (stmtLocation *current, stmtNode *t, pointerValue &operand, pointerValue &result) |
void | at_sizeof (stmtLocation *current, threeAddrNode *t, pointerValue &operand, pointerValue &result) |
void | at_binary (stmtLocation *current, stmtNode *s, pointerValue &left, pointerValue &right, pointerValue &result) |
void | at_const (stmtLocation *current, constNode *cons, pointerValue &result) |
void | at_address (stmtLocation *current, operandNode *operand, pointerValue &result) |
void | at_cast (stmtLocation *current, operandNode *operand, pointerValue &operand_val, pointerValue &result) |
void | at_dereference (stmtLocation *current, operandNode *operand, pointerValue &result) |
void | at_field_access (stmtLocation *current, operandNode *operand, pointerValue &result) |
void | at_index (stmtLocation *current, operandNode *operand, pointerValue &result) |
void | at_assignment (stmtLocation *current, pointerValue &left, pointerValue &right, pointerValue &result, memoryblock_set &changes) |
void | at_parameter_pass (Location *current, pointerValue &left, pointerValue &right, memoryblock_set &changes) |
void | at_self_assignment (Location *source, Location *target, memoryBlock *block, memoryblock_set &changes) |
void | at_return (stmtLocation *stmt, returnNode *ret, pointerValue &result, pointerValue &return_val) |
void | at_merge (Location *where, memoryBlock *block, memoryuse_list &phi_uses, pointerValue &result, memoryblock_set &changes) |
void | at_basicblock_entry (basicblockLocation *block, procedureInfo *info, pointerValue &initial) |
void | at_stmt_entry (stmtLocation *stmt, pointerValue &result) |
void | at_conservative_procedure_call (stmtLocation *current, operandNode *call, operand_list &args, pointerValue &call_target, pointervalue_list &arguments, memoryblock_set &reachable_blocks, pointerValue &return_val, memoryblock_set &changes) |
void | print (ostream &o, const constant *val) |
string | to_string (const constant *val) |
Private Types |
typedef set< constant > | constant_set |
typedef constant_set::iterator | constant_set_p |
typedef map< exprNode *, const
constant * > | expr_value_map |
typedef expr_value_map::iterator | expr_value_map_p |
typedef map< stmtNode *, const
constant * > | stmt_value_map |
typedef stmt_value_map::iterator | stmt_value_map_p |
Private Member Functions |
void | record_change (memoryDef *def) |
| Obsolete: Record a value change.
|
Private Attributes |
TREE constant_set | _schar_constants |
| The set of all constants.
|
TREE constant_set | _uchar_constants |
TREE constant_set | _sshort_constants |
TREE constant_set | _ushort_constants |
TREE constant_set | _sint_constants |
TREE constant_set | _uint_constants |
TREE constant_set | _slong_constants |
TREE constant_set | _ulong_constants |
TREE constant_set | _float_constants |
TREE constant_set | _double_constants |
REF memoryBlock * | _null |
| Null object.
|
const constant * | _top |
| Unique lattice top element.
|
const constant * | _bottom |
| Unique lattice bottom element.
|
const constant * | _non_null |
| Special non-null element.
|
expr_value_map | _expr_values |
| Record the value of each expression.
|
stmt_value_map | _stmt_values |
Member Typedef Documentation
Constructor & Destructor Documentation
constantAnalyzer::constantAnalyzer |
( |
|
) |
|
|
|
Create a new constant analysis.
|
constantAnalyzer::~constantAnalyzer |
( |
|
) |
|
|
Member Function Documentation
const constant* constantAnalyzer::bottom |
( |
|
) |
const [inline] |
|
void constantAnalyzer::clear |
( |
|
) |
|
|
|
Clear.
Prepare for a new analysis. |
|
Evaluate points-to set.
Determine the constant value of a pointer by looking at what it points to. There are basically three cases: (1) it only points to the NULL object, in which case it is zero, (2) it points to heap objects, which might fail to be allocated, so the value is bottom, or (3) it points to regular variables, whose addresses cannot be zero, so the value is non-null. |
bool constantAnalyzer::has_truth_value |
( |
const constant * |
val, |
|
|
bool & |
value |
|
) |
|
|
|
Check for truth value.
Return true if the given constant is true (including non-null). |
bool constantAnalyzer::has_value |
( |
const constant * |
val |
) |
[inline] |
|
|
Lookup a constant value.
All constants are stored in a set so that there is only one constant object for each unique value. |
|
Lookup a variable value.
Look for the constant value associated with a specific def. Default is TOP if none is found. |
void constantAnalyzer::print |
( |
ostream & |
o, |
|
|
const constant * |
val |
|
) |
[inline] |
|
|
Rebuild the flow value.
Collect the current values of the given pointer using the meet function |
void constantAnalyzer::record_change |
( |
memoryDef * |
def |
) |
[private] |
|
|
Obsolete: Record a value change.
|
void constantAnalyzer::record_expression |
( |
exprNode * |
expr, |
|
|
const constant * |
val |
|
) |
|
|
|
Record the value of an expression.
|
|
Record the rhs value of an threeAddr.
|
void constantAnalyzer::set_null_object |
( |
memoryBlock * |
null_object |
) |
[inline] |
|
|
Set the null object.
The pointer analyzer needs to provide this so that we can properly handle null pointers as constants.
Definition at line 125 of file constants.h.
References _null. |
string constantAnalyzer::to_string |
( |
const constant * |
val |
) |
[inline] |
|
const constant* constantAnalyzer::top |
( |
|
) |
const [inline] |
|
|
Update a variable value.
Don't record any TOP values (because lookup_flowvalue() will return TOP by default). Also, return a boolean indicating if the update resulted in a change. |
Member Data Documentation
|
Record the value of each expression.
This ends up as the context insensitive information
Definition at line 101 of file constants.h. |
|
The set of all constants.
This set ensures that each unique constant value is represented by exactly one constant object. It "owns" all of the constant values. All other data structures refer to these.
Definition at line 68 of file constants.h. |
The documentation for this class was generated from the following file:
|