pub struct Context<'a> { /* private fields */ }
Expand description

The context struct for the expression propagation fixpoint computation.

The computation is a intra procedural forward fixpoint calculation that stores at each node the set of registers with their propagated expressions. This expressions can be used for expression propagation among basic blocks.

Implementations§

source§

impl<'a> Context<'a>

source

pub fn new(graph: &'a Graph<'_>) -> Context<'a>

Create a new context object for the given project and control flow graph.

Trait Implementations§

source§

impl<'a> Context<'a> for Context<'a>

source§

fn merge(&self, value1: &Self::Value, value2: &Self::Value) -> Self::Value

Merges two values by intersecting their variable-expression pairs.

source§

fn update_def( &self, value: &Self::Value, def: &Term<Def> ) -> Option<Self::Value>

Adds the expression for the assigned variable to the table.

Invalid pairs are removed and new expressions are supplemented if possible.

§

type Value = HashMap<Variable, Expression>

The type of the values that are assigned to nodes during the fixpoint computation.
source§

fn get_graph(&self) -> &Graph<'a>

Get a reference to the graph that the fixpoint is computed on.
source§

fn update_call_stub( &self, _value_before_call: &Self::Value, _call: &Term<Jmp> ) -> Option<Self::Value>

Transition function for calls to functions not contained in the binary. The corresponding edge goes from the callsite to the returned-to block.
source§

fn update_jump( &self, value: &Self::Value, _jump: &Term<Jmp>, _untaken_conditional: Option<&Term<Jmp>>, _target: &Term<Blk> ) -> Option<Self::Value>

Transition function for (conditional and unconditional) Jmp terms.
source§

fn update_call( &self, _value: &Self::Value, _call: &Term<Jmp>, _target: &Node<'_>, _calling_convention: &Option<String> ) -> Option<Self::Value>

Transition function for in-program calls.
source§

fn update_return( &self, _value: Option<&Self::Value>, _value_before_call: Option<&Self::Value>, _call_term: &Term<Jmp>, _return_term: &Term<Jmp>, _calling_convention: &Option<String> ) -> Option<Self::Value>

Transition function for return instructions. Has access to the value at the callsite corresponding to the return edge. This way one can recover caller-specific information on return from a function.
source§

fn specialize_conditional( &self, value: &Self::Value, _condition: &Expression, _block_before_condition: &Term<Blk>, _is_true: bool ) -> Option<Self::Value>

This function is used to refine the value using the information on which branch was taken on a conditional jump.

Auto Trait Implementations§

§

impl<'a> RefUnwindSafe for Context<'a>

§

impl<'a> Send for Context<'a>

§

impl<'a> Sync for Context<'a>

§

impl<'a> Unpin for Context<'a>

§

impl<'a> UnwindSafe for Context<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.