pub struct AbstractIdentifier(/* private fields */);
Expand description
An abstract identifier is used to identify an object or a value in an abstract state.
Since many program states can be represented by the same abstract state in data-flow analysis, one sometimes needs a way to uniquely identify a variable or a memory object in all of the represented program states. Abstract identifiers achieve this by identifying a time, i.e. a specific abstract state, and a location, i.e. a recipe for computing a concrete value from any concrete state that is represented by the abstract state. The value in question then serves as the identifier. For example, a pointer may uniquely determine the memory object it is pointing to. Or a value may represent the value of a variable at a certain time, whereas the value of the variable in the current state is given as an offset to the value at the identified time.
Since program points may be visited several times during an execution trace (e.g. in loops), the time component of an abstract identifier may not actually determine an unique point in time of an execution trace. In this case the meaning of an abstract identifier depends upon its use case. E.g. it may represent the union of all values at the specific location for each time the program point is visited during an execution trace or it may only represent the value at the last time the program point was visited.
Alternatively, one can also add path hints to an identifier to further distinguish points in time in an execution trace. Path hints are given as a possibly empty array of time identifiers. To prevent infinitely long path hints, each time identifier is only allowed to appear at most once in the array. The specific meaning of the path hints depends upon the use case.
An abstract identifier is given by a time identifier, a location identifier and a path hints array (containing time identifiers).
For the location identifier see AbstractLocation
.
The time identifier is given by a Tid
.
If it is the Tid
of a basic block, then it describes the point in time before execution of the first instruction in the block.
If it is the Tid
of a Def
or Jmp
, then it describes the point in time after the execution of the Def
or Jmp
.
Implementations§
source§impl AbstractIdentifier
impl AbstractIdentifier
sourcepub fn new(time: Tid, location: AbstractLocation) -> AbstractIdentifier
pub fn new(time: Tid, location: AbstractLocation) -> AbstractIdentifier
Create a new abstract identifier.
sourcepub fn from_var(time: Tid, variable: &Variable) -> AbstractIdentifier
pub fn from_var(time: Tid, variable: &Variable) -> AbstractIdentifier
Create a new abstract identifier where the abstract location is a register. Panics if the register is a temporary register.
sourcepub fn from_arg(time: &Tid, arg: &Arg) -> AbstractIdentifier
pub fn from_arg(time: &Tid, arg: &Arg) -> AbstractIdentifier
Create an abstract identifier from a parameter argument.
If the argument is a sub-register, then the created identifier contains the whole base register.
sourcepub fn from_global_address(
time: &Tid,
address: &Bitvector
) -> AbstractIdentifier
pub fn from_global_address( time: &Tid, address: &Bitvector ) -> AbstractIdentifier
Create an abstract identifier from an address into global memory.
sourcepub fn with_path_hint(&self, path_hint: Tid) -> Result<Self, Error>
pub fn with_path_hint(&self, path_hint: Tid) -> Result<Self, Error>
Create a new abstract identifier
by pushing the given path hint to the array of path hints of self
.
Returns an error if the path hint is already contained in the path hints of self
.
sourcepub fn without_last_path_hint(&self) -> (Self, Option<Tid>)
pub fn without_last_path_hint(&self) -> (Self, Option<Tid>)
Create a new abstract identifier by removing the last path hint from the path hint array of self
.
Return the new identifier together with the removed path hint (or none if self
has no path hints).
sourcepub fn get_path_hints(&self) -> &[Tid]
pub fn get_path_hints(&self) -> &[Tid]
Get the path hints array of self
.
sourcepub fn unwrap_register(&self) -> &Variable
pub fn unwrap_register(&self) -> &Variable
Get the register associated to the abstract location. Panics if the abstract location is not a register but a memory location.
sourcepub fn get_location(&self) -> &AbstractLocation
pub fn get_location(&self) -> &AbstractLocation
Get the location component of the abstract ID.
sourcepub fn bytesize(&self) -> ByteSize
pub fn bytesize(&self) -> ByteSize
Get the bytesize of the value represented by the abstract ID.
sourcepub fn get_id_with_parent_location(
&self,
generic_pointer_size: ByteSize
) -> Option<AbstractIdentifier>
pub fn get_id_with_parent_location( &self, generic_pointer_size: ByteSize ) -> Option<AbstractIdentifier>
If the abstract location of self
has a parent location
then return the ID one gets when replacing the abstract location in self
with its parent location.
Trait Implementations§
source§impl Clone for AbstractIdentifier
impl Clone for AbstractIdentifier
source§fn clone(&self) -> AbstractIdentifier
fn clone(&self) -> AbstractIdentifier
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for AbstractIdentifier
impl Debug for AbstractIdentifier
source§impl Deref for AbstractIdentifier
impl Deref for AbstractIdentifier
source§impl<'de> Deserialize<'de> for AbstractIdentifier
impl<'de> Deserialize<'de> for AbstractIdentifier
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Display for AbstractIdentifier
impl Display for AbstractIdentifier
source§impl Hash for AbstractIdentifier
impl Hash for AbstractIdentifier
source§impl Ord for AbstractIdentifier
impl Ord for AbstractIdentifier
source§fn cmp(&self, other: &AbstractIdentifier) -> Ordering
fn cmp(&self, other: &AbstractIdentifier) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for AbstractIdentifier
impl PartialEq for AbstractIdentifier
source§fn eq(&self, other: &AbstractIdentifier) -> bool
fn eq(&self, other: &AbstractIdentifier) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for AbstractIdentifier
impl PartialOrd for AbstractIdentifier
source§fn partial_cmp(&self, other: &AbstractIdentifier) -> Option<Ordering>
fn partial_cmp(&self, other: &AbstractIdentifier) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for AbstractIdentifier
impl Serialize for AbstractIdentifier
impl Eq for AbstractIdentifier
impl StructuralEq for AbstractIdentifier
impl StructuralPartialEq for AbstractIdentifier
Auto Trait Implementations§
impl RefUnwindSafe for AbstractIdentifier
impl Send for AbstractIdentifier
impl Sync for AbstractIdentifier
impl Unpin for AbstractIdentifier
impl UnwindSafe for AbstractIdentifier
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.