Skip to main content

PromotableRegionOpInterface

Trait PromotableRegionOpInterface 

Source
pub trait PromotableRegionOpInterface: Op {
    // Required methods
    fn is_region_promotable(
        &self,
        ctx: &Context,
        alloc: &AllocInfo,
        region: Ptr<Region>,
        has_value_stores: bool,
    ) -> bool;
    fn setup_promotion(
        &self,
        ctx: &mut Context,
        alloc: &AllocInfo,
        reaching_def: Value,
        has_value_stores: bool,
        regions_to_process: &mut SmallMap<Ptr<Region>, Value, 2>,
    );
    fn finalize_promotion(
        &self,
        ctx: &mut Context,
        alloc: &AllocInfo,
        entry_reaching_def: Value,
        has_value_stores: bool,
        reaching_at_block_end: &HMap<Ptr<BasicBlock>, Value>,
    ) -> Value;

    // Provided method
    fn verify(_op: &dyn Op, _ctx: &Context) -> Result<()>
       where Self: Sized { ... }
}

Required Methods§

Source

fn is_region_promotable( &self, ctx: &Context, alloc: &AllocInfo, region: Ptr<Region>, has_value_stores: bool, ) -> bool

Returns true if region (a child of this op) can be analysed for promotion with respect to alloc. has_value_stores is a hint: true when the region contains stores to alloc.

Source

fn setup_promotion( &self, ctx: &mut Context, alloc: &AllocInfo, reaching_def: Value, has_value_stores: bool, regions_to_process: &mut SmallMap<Ptr<Region>, Value, 2>, )

Called before descending into nested regions. reaching_def is the value in slot on entry to this op. Populate regions_to_process with the reaching def each region starts with. You may mutate the op in place, but do NOT delete ops or touch terminators.

Source

fn finalize_promotion( &self, ctx: &mut Context, alloc: &AllocInfo, entry_reaching_def: Value, has_value_stores: bool, reaching_at_block_end: &HMap<Ptr<BasicBlock>, Value>, ) -> Value

Called after reaching defs are computed for all regions, but before blocking uses are removed. Returns the new reaching def at the op’s exit. Mutation is allowed, but you must not change control flow or add ops that interact with the slot’s value.

Provided Methods§

Source

fn verify(_op: &dyn Op, _ctx: &Context) -> Result<()>
where Self: Sized,

Trait Implementations§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§