23 #ifndef CPROVER_ANALYSES_AI_STORAGE_H
24 #define CPROVER_ANALYSES_AI_STORAGE_H
103 typedef std::map<locationt, trace_set_ptrt, goto_programt::target_less_than>
111 trace_mapt::iterator it =
trace_map.find(p->current_location());
115 auto ins =
trace_map.emplace(p->current_location(), s);
122 it->second->insert(p);
130 trace_mapt::const_iterator it =
trace_map.find(l);
157 typedef std::unordered_map<
186 typename state_mapt::const_iterator it =
state_map.find(l);
196 return get_state(p->current_location(), fac);
206 typename state_mapt::const_iterator it =
state_map.find(l);
209 std::shared_ptr<statet> d(fac.make(l));
215 return *(it->second);
230 typedef std::map<trace_ptrt, state_ptrt, ai_history_baset::compare_historyt>
241 return fac.
make(p->current_location());
252 if(traces->size() == 0)
256 else if(traces->size() == 1)
258 auto it =
domain_map.find(*(traces->begin()));
260 it !=
domain_map.end(),
"domain_map must be in sync with trace_map");
266 auto res = fac.
make(t);
268 for(
auto p : *traces)
272 it !=
domain_map.end(),
"domain_map must be in sync with trace_map");
273 fac.
merge(*res, *(it->second), p, p);
287 std::shared_ptr<statet> d(fac.
make(p->current_location()));
293 return *(it->second);
Abstract Interpretation Domain.
Abstract Interpretation history.
The interface offered by a domain, allows code to manipulate domains without knowing their exact type...
virtual std::unique_ptr< statet > make(locationt l) const =0
virtual bool merge(statet &dest, const statet &src, trace_ptrt from, trace_ptrt to) const =0
A history object is an abstraction / representation of the control-flow part of a set of traces.
std::shared_ptr< const ai_history_baset > trace_ptrt
History objects are intended to be immutable so they can be shared to reduce memory overhead.
std::set< trace_ptrt, compare_historyt > trace_sett
This is the basic interface for storing domains.
virtual void clear()
Reset the abstract state.
virtual ~ai_storage_baset()
goto_programt::const_targett locationt
virtual cstate_ptrt abstract_state_before(trace_ptrt p, const ai_domain_factory_baset &fac) const =0
Non-modifying access to the stored domains, used in the ai_baset public interface.
std::shared_ptr< trace_sett > trace_set_ptrt
ai_history_baset::trace_sett trace_sett
virtual void prune(locationt l)
Notifies the storage that the user will not need the domain object(s) for this location.
std::shared_ptr< const trace_sett > ctrace_set_ptrt
ai_history_baset::trace_ptrt trace_ptrt
virtual cstate_ptrt abstract_state_before(locationt l, const ai_domain_factory_baset &fac) const =0
std::shared_ptr< statet > state_ptrt
virtual ctrace_set_ptrt abstract_traces_before(locationt l) const =0
Returns all of the histories that have reached the start of the instruction.
std::shared_ptr< const statet > cstate_ptrt
virtual statet & get_state(trace_ptrt p, const ai_domain_factory_baset &fac)=0
Look up the analysis state for a given history, instantiating a new domain if required.
instructionst::const_iterator const_targett
void clear() override
Reset the abstract state.
cstate_ptrt abstract_state_before(trace_ptrt p, const ai_domain_factory_baset &fac) const override
Non-modifying access to the stored domains, used in the ai_baset public interface.
statet & get_state(trace_ptrt p, const ai_domain_factory_baset &fac) override
Look up the analysis state for a given history, instantiating a new domain if required.
std::map< trace_ptrt, state_ptrt, ai_history_baset::compare_historyt > domain_mapt
cstate_ptrt abstract_state_before(locationt t, const ai_domain_factory_baset &fac) const override
The most conventional storage; one domain per location.
cstate_ptrt abstract_state_before(trace_ptrt p, const ai_domain_factory_baset &fac) const override
Non-modifying access to the stored domains, used in the ai_baset public interface.
friend variable_sensitivity_dependence_grapht
statet & get_state(trace_ptrt p, const ai_domain_factory_baset &fac) override
Look up the analysis state for a given history, instantiating a new domain if required.
cstate_ptrt abstract_state_before(locationt l, const ai_domain_factory_baset &fac) const override
friend invariant_propagationt
void clear() override
Reset the abstract state.
std::unordered_map< locationt, state_ptrt, const_target_hash, pointee_address_equalt > state_mapt
This is location sensitive so we store one domain per location.
ctrace_set_ptrt abstract_traces_before(locationt l) const override
Returns all of the histories that have reached the start of the instruction.
std::map< locationt, trace_set_ptrt, goto_programt::target_less_than > trace_mapt
void register_trace(trace_ptrt p)
void clear() override
Reset the abstract state.
#define SINCE(year, month, day, msg)
#define CHECK_RETURN(CONDITION)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define POSTCONDITION(CONDITION)
Functor to check whether iterators from different collections point at the same object.