pub struct Blk {
    pub defs: Vec<Term<Def>>,
    pub jmps: Vec<Term<Jmp>>,
    pub indirect_jmp_targets: Vec<Tid>,
}
Expand description

A basic block is a sequence of Def instructions followed by up to two Jmp instructions.

The Def instructions represent side-effectful operations that are executed in order when the block is entered. Def instructions do not affect the control flow of a program.

The Jmp instructions represent control flow affecting operations. There can only be zero, one or two Jmps:

  • Zero Jmps indicate that the next execution to be executed could not be discerned. This should only happen on disassembler errors or on dead ends in the control flow graph that were deliberately inserted by the user.
  • If there is exactly one Jmp, it is required to be an unconditional jump.
  • For two jumps, the first one has to be a conditional jump, where the second unconditional jump is only taken if the condition of the first jump evaluates to false.

If one of the Jmp instructions is an indirect jump, then the indirect_jmp_targets is a list of possible jump target addresses for that jump. The list may not be complete and the entries are not guaranteed to be correct.

Basic blocks are single entry, single exit, i.e. a basic block is only entered at the beginning and is only exited by the jump instructions at the end of the block. If a new control flow edge is discovered that would jump to the middle of a basic block, the block structure needs to be updated accordingly.

Fields§

§defs: Vec<Term<Def>>

The Def instructions of the basic block in order of execution.

§jmps: Vec<Term<Jmp>>

The Jmp instructions of the basic block

§indirect_jmp_targets: Vec<Tid>

If the basic block contains an indirect jump, this field contains possible jump target addresses for the jump.

Note that possible targets of indirect calls are not contained, since the Project normalization passes assume that only intraprocedural jump targets are contained in this field.

Trait Implementations§

source§

impl Clone for Blk

source§

fn clone(&self) -> Blk

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Blk

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Blk

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Blk

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for Blk

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Blk

source§

fn eq(&self, other: &Blk) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Blk

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Blk

source§

impl StructuralEq for Blk

source§

impl StructuralPartialEq for Blk

Auto Trait Implementations§

§

impl RefUnwindSafe for Blk

§

impl Send for Blk

§

impl Sync for Blk

§

impl Unpin for Blk

§

impl UnwindSafe for Blk

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,