pub struct Alias<'a> { /* private fields */ }Expand description
The analysis over one function.
It borrows the function because nearly everything it asks is a question about one, and it
borrows an Outside because the rest is a question about the module: whether two symbols are
two objects, what a callee is declared to do, where a type node sits in the tree, and how wide
an address is. That is a copy of four module facts rather than the module itself, so that a
pass handed &mut module[id] can still build this. See crate::outside for why.
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>
impl<'a> Alias<'a>
Sourcepub fn new(func: &'a Func, outside: &'a Outside) -> Self
pub fn new(func: &'a Func, outside: &'a Outside) -> Self
The analysis of this function, with the type-based layer on, which is GCC’s -O2.
Sourcepub fn with(func: &'a Func, outside: &'a Outside, options: Options) -> Self
pub fn with(func: &'a Func, outside: &'a Outside, options: Options) -> Self
The same, with the type-based layer where the command line left it.
Sourcepub const fn escapes(&self) -> &Escapes
pub const fn escapes(&self) -> &Escapes
Which locals escaped, for a caller that wants the fact on its own.
Sourcepub fn reads(&self, inst: Inst) -> Option<Access>
pub fn reads(&self, inst: Inst) -> Option<Access>
The bytes this instruction reads, if it reads any.
Sourcepub fn writes(&self, inst: Inst) -> Option<Access>
pub fn writes(&self, inst: Inst) -> Option<Access>
The bytes this instruction writes, if it writes any.
Sourcepub fn query(&mut self, a: &Access, b: &Access) -> Answer
pub fn query(&mut self, a: &Access, b: &Access) -> Answer
Whether these two references can touch the same byte.
Sourcepub fn clobbered_by(&mut self, reference: &Access, call: Inst) -> Answer
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.