00001 #ifndef INIT_INTERVAL_LATTICE_H 00002 #define INIT_INTERVAL_LATTICE_H 00003 00004 #include "interval_lattice.h" 00005 00006 /* 00007 * InitIntervalVal 00008 * This is an interval lattice that handles initial values 00009 * It does NOT have finite descending but has a widen 00010 * operation that will force convergence. 00011 * The init value is the SMASH product of 00012 * INIT + IntervalLattice, IntervalLattice 00013 * 00014 * with TOP and bottom 00015 * 00016 * This is useful in region-based analysis 00017 */ 00018 class InitIntervalVal { 00019 enum bval { B_TOP, B_CONST, B_INITIAL, B_BOTTOM }; 00020 typedef enum bval BVal; 00021 00022 bool _is_top; 00023 bool _is_bottom; 00024 enum 00025 00026 IntervalLattice _init_lattice; 00027 IntervalLattice _const_lattice; 00028 public: 00029 IntervalVal(bool is_exact, 00030 IInteger start_offset, 00031 IInteger end_offset); 00032 IntervalVal(); /* bottom offset (i.e. any offset, inexact) */ 00033 IntervalVal(const IntervalVal &other); 00034 IntervalVal &operator=(const IntervalVal &other); 00035 bool operator==(const IntervalVal &other) const; 00036 bool operator!=(const IntervalVal &other) const; 00037 00038 ~IntervalVal(); 00039 String toString() const; 00040 // ObjectContext *get_object_context() const; 00041 00042 bool is_top() const; 00043 bool get_is_exact() const; 00044 // Computed 00045 bool is_bottom() const; 00046 IInteger get_start_offset() const; 00047 IInteger get_end_offset() const; 00048 00049 00050 static IntervalVal do_meet(const IntervalVal &v1, 00051 const IntervalVal &v2); 00052 static IntervalVal do_widen(const IntervalVal &v1, 00053 const IntervalVal &v2); 00054 bool do_meet_with_test(const IntervalVal &other); 00055 // Widen will force upper bounds to Inf or 00056 // lower bounds to -inf 00057 bool do_widen_with_test(const IntervalVal &other); 00058 }; 00059 00060 00061 00062 #endif /* INTERVAL_LATTICE_H */