Skip to main content

Alias

Struct Alias 

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

The analysis over one function.

It borrows the module because a global’s address is a symbol and whether two symbols are two objects is a question about the module, and it borrows the function because everything else is. The escape analysis is run once when this is built, since every query may ask it and it is one walk over the function.

Implementations§

Source§

impl<'a> Alias<'a>

Source

pub fn new(func: &'a Func, module: &'a Module) -> Self

The analysis of this function, with the type-based layer on, which is GCC’s -O2.

Source

pub fn with(func: &'a Func, module: &'a Module, options: Options) -> Self

The same, with the type-based layer where the command line left it.

Source

pub const fn escapes(&self) -> &Escapes

Which locals escaped, for a caller that wants the fact on its own.

Source

pub const fn counts(&self) -> &Counts

What each layer has answered so far.

Source

pub fn reads(&self, inst: Inst) -> Option<Access>

The bytes this instruction reads, if it reads any.

Source

pub fn writes(&self, inst: Inst) -> Option<Access>

The bytes this instruction writes, if it writes any.

Source

pub fn query(&mut self, a: &Access, b: &Access) -> Answer

Whether these two references can touch the same byte.

Source

pub fn clobbered_by(&mut self, reference: &Access, call: Inst) -> Answer

Whether this call can write the bytes the reference covers.

GCC’s call_may_clobber_ref_p_1. Without interprocedural summaries the honest answer for anything whose address escaped is yes, and section 8.4 says so plainly: the full mod and ref summary is ipa-modref, it is five and a half thousand lines, and it is document 34’s. What is here is the cheap part of it, which is the attributes a C programmer already wrote and the escape analysis.

Source

pub fn read_by(&mut self, reference: &Access, call: Inst) -> Answer

Whether this call can read them.

GCC’s ref_maybe_used_by_call_p_1, and the same argument as Alias::clobbered_by.

Trait Implementations§

Source§

impl<'a> Debug for Alias<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Alias<'a>

§

impl<'a> RefUnwindSafe for Alias<'a>

§

impl<'a> Send for Alias<'a>

§

impl<'a> Sync for Alias<'a>

§

impl<'a> Unpin for Alias<'a>

§

impl<'a> UnsafeUnpin for Alias<'a>

§

impl<'a> UnwindSafe for Alias<'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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.