00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef CBZ_IPANALYSIS_H
00039 #define CBZ_IPANALYSIS_H
00040
00041 #include "pointeroptions.h"
00042 #include "proceduredb.h"
00043
00044 class analysisVal
00045 {
00046 public:
00047 virtual ~analysisVal() {}
00048 virtual analysisVal * clone() const =0;
00049
00050 };
00051
00052
00053 class pointerValue;
00054
00055 typedef list< pointerValue > pointervalue_list;
00056
00057
00058
00059
00060 class analysisProblem
00061 {
00062 protected:
00063
00064 Direction _direction;
00065
00066 public:
00067
00072 analysisProblem(Direction direction)
00073 : _direction(direction)
00074 {}
00075
00078 Direction direction() const { return _direction; }
00079
00084 virtual string name() =0;
00085
00093
00094
00095
00096 virtual void at_id(stmtLocation * current, idNode * id,
00097 pointerValue & result)
00098 {}
00099
00100 virtual void at_unary(stmtLocation * current,
00101 threeAddrNode *r,
00102 pointerValue & operand,
00103 pointerValue & result)
00104 {}
00105
00106 virtual void at_sizeof(stmtLocation * current,
00107 threeAddrNode *r,
00108 pointerValue & operand,
00109 pointerValue & result)
00110 {}
00111
00112 virtual void at_binary(stmtLocation * current,
00113 stmtNode *r,
00114 pointerValue & left,
00115 pointerValue & right,
00116 pointerValue & result)
00117 {}
00118
00119 virtual void at_cast(stmtLocation * current, operandNode *operand,
00120 pointerValue & operand_value,
00121 pointerValue & result)
00122 {}
00123
00124 virtual void at_const(stmtLocation * current, constNode * cons,
00125 pointerValue & result)
00126 {}
00127
00128
00129
00130 virtual void at_call(stmtLocation * current, operandNode * call,
00131 pointerValue & call_target,
00132 procNode * callee,
00133 pointervalue_list & arguments,
00134 pointerValue & return_val)
00135 {}
00136
00137
00138
00139 virtual void at_field_access(stmtLocation * current,
00140 operandNode *operand,
00141 pointerValue & operand_value,
00142 pointerValue & result)
00143 {}
00144
00145 virtual void at_dereference(stmtLocation * current,
00146 operandNode *operand,
00147 pointerValue & operand_value,
00148 pointerValue & result)
00149 {}
00150
00151 virtual void at_address(stmtLocation * current,
00152 operandNode *operand,
00153 pointerValue & operand_value,
00154 pointerValue & result)
00155 {}
00156
00157 virtual void at_index(stmtLocation * current,
00158 operandNode *operand,
00159 pointerValue & left,
00160 pointerValue & right,
00161 pointerValue & result)
00162 {}
00163
00164
00165
00166 virtual void at_assignment(stmtLocation * current,
00167 pointerValue & left,
00168 pointerValue & right,
00169 pointerValue & result,
00170 memoryblock_set & changes)
00171 {}
00172
00173 virtual void at_parameter_pass(Location * current,
00174 stmtLocation * parameter_callsite,
00175 pointerValue & left,
00176 pointerValue & right,
00177 memoryblock_set & changes)
00178 {}
00179
00180 virtual void at_self_assignment(Location * source,
00181 Location * target,
00182 memoryBlock * block,
00183 memoryblock_set & changes,
00184 bool is_input)
00185 {}
00186
00187
00188
00189 virtual void at_return(Location * current,
00190 pointerValue & left,
00191 pointerValue & right,
00192 memoryblock_set & changes)
00193 {}
00194
00195
00196 virtual void at_threeAddr(stmtLocation *stmt,
00197 threeAddrNode *threeaddr,
00198 pointerValue &result) {}
00199
00200 virtual void at_conditiongoto(stmtLocation *stmt,
00201 conditiongotoNode *c,
00202 pointerValue &result) {}
00203
00204
00205
00206 virtual void at_allocation(stmtLocation * stmt,
00207 pointervalue_list & arguments,
00208 memoryBlock * block,
00209 memoryblock_set & changes)
00210 {}
00211
00212 virtual void at_deallocation(stmtLocation * stmt,
00213 pointerValue & to_deallocate,
00214 memoryblock_set & changes)
00215 {}
00216
00217
00218
00219 virtual void at_merge(Location * where,
00220 memoryBlock * block,
00221 memoryuse_list & phi_uses,
00222 pointerValue & result,
00223 memoryblock_set & changes)
00224 {}
00225
00226
00227
00228 virtual void at_basicblock_entry(basicblockLocation * block,
00229 procedureInfo * info,
00230 pointerValue & initial)
00231 {}
00232
00233 virtual void at_stmt_entry(stmtLocation * stmt,
00234 pointerValue & result)
00235 {}
00236
00237 virtual void at_stmt_exit(stmtLocation * stmt,
00238 pointerValue & result)
00239 {}
00240
00241 virtual void at_basicblock_exit(basicblockLocation * block,
00242 procedureInfo * info,
00243 pointerValue & final)
00244 {}
00245
00246
00247
00248 virtual void at_conservative_procedure_call(stmtLocation * current,
00249 operandNode * call,
00250 operand_list & args,
00251 pointerValue & call_target,
00252 pointervalue_list & arguments,
00253 memoryblock_set & reachable_blocks,
00254 pointerValue & return_val,
00255 memoryblock_set & changes)
00256 {}
00257
00258 virtual void at_procedure_entry(procLocation * proc,
00259 procedureInfo * info,
00260 pointerValue & return_val)
00261 {}
00262
00263 virtual void at_procedure_exit(procLocation * proc,
00264 procedureInfo * info,
00265 pointerValue & return_val)
00266 {}
00268
00272
00273 virtual bool compare_property_value(Location *where,
00274 memoryBlock *property_block,
00275 procedureInfo *callee) { return true; }
00276
00279
00280 virtual void record_input_to_value(procedureInfo *callee,
00281 memoryBlock *property_block,
00282 Location *where) {}
00283
00284 };
00285
00286 #endif // CBZ_IPANALYSIS_H
00287