Struct AddrTerm
pub struct AddrTerm {
pub primary: AddrTermCalculation,
pub second_use: Option<AddrTermCalculation>,
}
Expand description
An address term, consisting of a primary sized shift-then-multipy operation, and an optional second sized shift-then-multiply operation.
Fields§
§primary: AddrTermCalculation
The primary operation on the input.
second_use: Option<AddrTermCalculation>
The optional second use of the input.
Implementations§
§impl AddrTerm
impl AddrTerm
pub fn empty() -> Self
pub fn empty() -> Self
Creates a new address term that always returns 0.
pub fn identity() -> Self
pub fn identity() -> Self
Creates an address term that always returns the value it receives.
pub fn single(size: AddrTermSize, right: u8, mult: u8) -> Self
pub fn single(size: AddrTermSize, right: u8, mult: u8) -> Self
Creates an address term that sizes, shifts and multiplies once.
pub fn compute_relocation(
self,
current_value: u64,
current_output: u64,
target_output: u64,
) -> Option<u64>
pub fn compute_relocation( self, current_value: u64, current_output: u64, target_output: u64, ) -> Option<u64>
Computes a new value for this term that would move the memory access from current_output
to target_output
, given that the input for the term is currently current_value
.
pub fn offset_is_valid(self, offset: i64) -> bool
pub fn offset_is_valid(self, offset: i64) -> bool
Returns true if the delta between two accesses where only this term differs can be offset
.
pub fn minimum_step_size(self) -> u64
pub fn minimum_step_size(self) -> u64
Returns the minimum step size of this term.
pub fn is_valid_delta(
self,
original_value: u64,
new_value: u64,
original_address: u64,
new_address: u64,
) -> bool
pub fn is_valid_delta( self, original_value: u64, new_value: u64, original_address: u64, new_address: u64, ) -> bool
Determines whether the change from original_address
to new_address
could have occurred given that the original value for this term was original_value
, and for new_address
it was new_value
.
pub fn is_possible_with_delta(
&self,
original_address: u64,
new_address: u64,
) -> bool
pub fn is_possible_with_delta( &self, original_address: u64, new_address: u64, ) -> bool
Determines whether this term could be part of an address calculation, if modifying only this term changes the address of a memory access from original_address
to new_address
.
Trait Implementations§
§impl<'de> Deserialize<'de> for AddrTerm
impl<'de> Deserialize<'de> for AddrTerm
§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>,
§impl JsonSchema for AddrTerm
impl JsonSchema for AddrTerm
§fn schema_name() -> String
fn schema_name() -> String
§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref
keyword. Read more§impl Ord for AddrTerm
impl Ord for AddrTerm
§impl PartialOrd for AddrTerm
impl PartialOrd for AddrTerm
impl Copy for AddrTerm
impl Eq for AddrTerm
impl StructuralPartialEq for AddrTerm
Auto Trait Implementations§
impl Freeze for AddrTerm
impl RefUnwindSafe for AddrTerm
impl Send for AddrTerm
impl Sync for AddrTerm
impl Unpin for AddrTerm
impl UnwindSafe for AddrTerm
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more