pub struct StackAllocationOpt {
pub analyzer: EscapeAnalyzer,
pub config: EscapeOptConfig,
}Expand description
Optimization pass that uses escape analysis results to annotate or rewrite LCNF declarations so that non-escaping allocations can be stack-allocated.
Fields§
§analyzer: EscapeAnalyzerThe escape analyzer backing this pass.
config: EscapeOptConfigConfiguration.
Implementations§
Source§impl StackAllocationOpt
impl StackAllocationOpt
Sourcepub fn with_config(config: EscapeOptConfig) -> Self
pub fn with_config(config: EscapeOptConfig) -> Self
Create a new pass with explicit configuration.
Sourcepub fn run(&mut self, decls: &mut [LcnfFunDecl])
pub fn run(&mut self, decls: &mut [LcnfFunDecl])
Run the pass over all declarations. Declarations are modified in-place (currently: analysis results are stored; future work: rewrite IR).
Sourcepub fn optimize_decl(
&self,
decl: &mut LcnfFunDecl,
analysis: &EscapeAnalysisResult,
)
pub fn optimize_decl( &self, decl: &mut LcnfFunDecl, analysis: &EscapeAnalysisResult, )
Apply escape-based optimizations to a single declaration.
Sourcepub fn mark_stack_allocated(expr: &mut LcnfExpr, candidates: &HashSet<String>)
pub fn mark_stack_allocated(expr: &mut LcnfExpr, candidates: &HashSet<String>)
Walk the expression tree and mark allocation sites that appear in
candidates as stack-allocatable (currently a no-op annotation hook;
real backends would lower these differently).
Sourcepub fn report(&self) -> EscapeReport
pub fn report(&self) -> EscapeReport
Build an EscapeReport from the analysis results accumulated so far.
Trait Implementations§
Source§impl Debug for StackAllocationOpt
impl Debug for StackAllocationOpt
Source§impl Default for StackAllocationOpt
impl Default for StackAllocationOpt
Source§fn default() -> StackAllocationOpt
fn default() -> StackAllocationOpt
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StackAllocationOpt
impl RefUnwindSafe for StackAllocationOpt
impl Send for StackAllocationOpt
impl Sync for StackAllocationOpt
impl Unpin for StackAllocationOpt
impl UnsafeUnpin for StackAllocationOpt
impl UnwindSafe for StackAllocationOpt
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
Mutably borrows from an owned value. Read more