Go to the documentation of this file.
25 #ifndef CPROVER_ANALYSES_REACHING_DEFINITIONS_H
26 #define CPROVER_ANALYSES_REACHING_DEFINITIONS_H
45 const V &
get(
const std::size_t value_index)
const
47 assert(value_index<
values.size());
48 return values[value_index]->first;
51 std::size_t
add(
const V &value)
55 std::pair<typename inner_mapt::iterator, bool> entry=
56 m.insert(std::make_pair(value,
values.size()));
59 values.push_back(entry.first);
61 return entry.first->second;
76 std::vector<typename inner_mapt::const_iterator>
values;
219 "If domain is top, the value map must be empty");
226 "If domain is bottom, the value map must be empty");
251 typedef std::multimap<range_spect, range_spect>
rangest;
277 typedef std::map<irep_idt, values_innert>
valuest;
279 typedef std::unordered_map<irep_idt, values_innert>
valuest;
291 typedef std::unordered_map<irep_idt, ranges_at_loct>
export_cachet;
347 void output(std::ostream &out)
const;
391 #endif // CPROVER_ANALYSES_REACHING_DEFINITIONS_H
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
bool is_top() const override final
valuest values
It is an ordered map from program variable names to IDs of reaching_definitiont instances stored in m...
void populate_cache(const irep_idt &identifier) const
Given the passed variable name identifier it collects data from bv_container for each ID in values[id...
bool merge(const rd_range_domaint &other, trace_ptrt from, trace_ptrt to)
Implements the "join" operation of two instances *this and other.
std::map< reaching_definitiont, std::size_t > inner_mapt
reaching_definitions_analysist(const namespacet &_ns)
Dirty variables are ones which have their address taken so we can't reliably work out where they may ...
value_setst & get_value_sets() const
An instance of this class provides an assignment of unique numeric ID to each inserted reaching_defin...
ai_domain_baset::locationt definition_at
The iterator to the GOTO instruction where the variable has been written to.
void transform_assign(const namespacet &ns, locationt from, const irep_idt &function_to, locationt to, reaching_definitions_analysist &rd)
Data type to describe upper and lower bounds of the range of bits that a read or write access may aff...
std::unordered_map< irep_idt, inner_mapt > value_map
A map from names of program variables to a set of pairs (reaching_definitiont, ID).
std::map< locationt, rangest > ranges_at_loct
const is_threadedt & get_is_threaded() const
std::vector< typename inner_mapt::const_iterator > values
It is a map from an ID to the corresponding reaching_definitiont instance inside the map value_map.
std::set< std::size_t > values_innert
tvt has_values
This (three value logic) flag determines, whether the instance represents top, bottom,...
sparse_bitvector_analysist< reaching_definitiont > *const bv_container
It points to the actual reaching definitions data of individual program variables.
void make_bottom() final override
no states
range_spect bit_begin
The two integers below define a range of bits (i.e.
const ranges_at_loct & get(const irep_idt &identifier) const
ai_history_baset::trace_ptrt trace_ptrt
std::size_t add(const V &value)
void transform_function_call(const namespacet &ns, const irep_idt &function_from, locationt from, const irep_idt &function_to, reaching_definitions_analysist &rd)
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
std::unique_ptr< is_threadedt > is_threaded
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
irep_idt identifier
The name of the variable which was defined.
bool is_bottom() const override final
#define PRECONDITION(CONDITION)
Because the class is inherited from ai_domain_baset, its instance represents an element of a domain o...
void transform(const irep_idt &function_from, trace_ptrt trace_from, const irep_idt &function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override
Computes an instance obtained from the instance *this by transformation over a GOTO instruction refer...
bool gen(locationt from, const irep_idt &identifier, const range_spect &range_start, const range_spect &range_end)
A utility function which updates internal data structures by inserting a new reaching definition reco...
bool operator<(const reaching_definitiont &a, const reaching_definitiont &b)
In order to use instances of this structure as keys in ordered containers, such as std::map,...
std::map< irep_idt, ranges_at_loct > export_cachet
std::multimap< range_spect, range_spect > rangest
bool merge_inner(values_innert &dest, const values_innert &other)
void transform_dead(const namespacet &ns, locationt from)
Computes an instance obtained from a *this by transformation over DEAD v GOTO instruction.
virtual ~reaching_definitions_analysist()
A collection of goto functions.
goto_programt::const_targett locationt
void make_entry() final override
Make this domain a reasonable entry-point state.
void transform_start_thread(const namespacet &ns, reaching_definitions_analysist &rd)
const dirtyt & get_is_dirty() const
void make_top() final override
all states – the analysis doesn't use this, and domains may refuse to implement it.
bool merge_shared(const rd_range_domaint &other, locationt from, locationt to, const namespacet &ns)
reaching_definitiont(const irep_idt &identifier, const ai_domain_baset::locationt &definition_at, const range_spect &bit_begin, const range_spect &bit_end)
Base class for concurrency-aware abstract interpretation.
This is the basic interface of the abstract interpreter with default implementations of the core func...
void initialize(const goto_functionst &goto_functions) override
Initialize all the abstract states for a whole program.
rd_range_domaint(sparse_bitvector_analysist< reaching_definitiont > *_bv_container)
export_cachet export_cache
It is a helper data structure.
void kill_inf(const irep_idt &identifier, const range_spect &range_start)
Identifies a GOTO instruction where a given variable is defined (i.e.
void kill(const irep_idt &identifier, const range_spect &range_start, const range_spect &range_end)
void output(std::ostream &out, const ai_baset &, const namespacet &) const final override
void transform_end_function(const namespacet &ns, const irep_idt &function_from, locationt from, const irep_idt &function_to, locationt to, reaching_definitions_analysist &rd)
The interface offered by a domain, allows code to manipulate domains without knowing their exact type...
std::unique_ptr< dirtyt > is_dirty
void clear_cache(const irep_idt &identifier) const
std::map< irep_idt, values_innert > valuest
const V & get(const std::size_t value_index) const
std::unique_ptr< value_setst > value_sets