use super::*;
use crate::analysis::graph::NodeIndex;
use crate::{abstract_domain::AbstractLocation, analysis::vsa_results::VsaResult};
impl<'a> VsaResult for PointerInference<'a> {
type ValueDomain = Data;
fn eval_address_at_def(&self, def_tid: &Tid) -> Option<Data> {
self.addresses_at_defs.get(def_tid).cloned()
}
fn eval_value_at_def(&self, def_tid: &Tid) -> Option<Data> {
self.values_at_defs.get(def_tid).cloned()
}
fn eval_at_jmp(&self, jmp_tid: &Tid, expression: &Expression) -> Option<Data> {
let state = self.states_at_tids.get(jmp_tid)?;
Some(state.eval(expression))
}
fn eval_parameter_arg_at_call(&self, jmp_tid: &Tid, parameter: &Arg) -> Option<Data> {
let state = self.states_at_tids.get(jmp_tid)?;
let context = self.computation.get_context().get_context();
state
.eval_parameter_arg(parameter, &context.project.runtime_memory_image)
.ok()
}
fn eval_parameter_location_at_call(
&self,
jmp_tid: &Tid,
parameter: &AbstractLocation,
) -> Option<Data> {
let state = self.states_at_tids.get(jmp_tid)?;
let context = self.computation.get_context().get_context();
Some(state.eval_abstract_location(parameter, &context.project.runtime_memory_image))
}
fn eval_at_node(&self, node: NodeIndex, expression: &Expression) -> Option<Data> {
if let NodeValue::Value(state) = self.get_node_value(node)? {
Some(state.eval(expression))
} else {
None
}
}
fn get_call_renaming_map(
&self,
call: &Tid,
) -> Option<&BTreeMap<AbstractIdentifier, Self::ValueDomain>> {
self.id_renaming_maps_at_calls.get(call)
}
}