pub trait PromotableAllocationInterface: Op {
// Required methods
fn alloc_info(&self, ctx: &Context) -> Vec<AllocInfo>;
fn default_value(
&self,
ctx: &mut Context,
inserter: &mut dyn Inserter,
alloc_info: &AllocInfo,
) -> Result<Value>;
fn promote(
&self,
ctx: &mut Context,
rewriter: &mut dyn Rewriter,
alloc_infos: &[AllocInfo],
) -> Result<()>;
}Expand description
A promotable memory allocation implements this interface to provide the necessary info for register promotion.
Required Methods§
Sourcefn alloc_info(&self, ctx: &Context) -> Vec<AllocInfo>
fn alloc_info(&self, ctx: &Context) -> Vec<AllocInfo>
Get the allocation info(s) for this operation.
Sourcefn default_value(
&self,
ctx: &mut Context,
inserter: &mut dyn Inserter,
alloc_info: &AllocInfo,
) -> Result<Value>
fn default_value( &self, ctx: &mut Context, inserter: &mut dyn Inserter, alloc_info: &AllocInfo, ) -> Result<Value>
Get the default value for an allocation. This is used
when there’s no reaching definition for a use. The alloc_info
passed is guaranteed to be one of the entries returned by alloc_info.
The inserter is positioned to be just before the alloc op.
Sourcefn promote(
&self,
ctx: &mut Context,
rewriter: &mut dyn Rewriter,
alloc_infos: &[AllocInfo],
) -> Result<()>
fn promote( &self, ctx: &mut Context, rewriter: &mut dyn Rewriter, alloc_infos: &[AllocInfo], ) -> Result<()>
Promote allocations. This is called after all uses have been promoted,
and should remove the allocation (not necessary the operation itself) from the IR.
The alloc_infos passed are guaranteed to be from the entries returned by alloc_info.
The rewriter is set to insert before this alloc op.