Trait RegUsageMapper

Source
pub trait RegUsageMapper: Debug {
    // Required methods
    fn get_use(&self, vreg: VirtualReg) -> Option<RealReg>;
    fn get_def(&self, vreg: VirtualReg) -> Option<RealReg>;
    fn get_mod(&self, vreg: VirtualReg) -> Option<RealReg>;
}
Expand description

A trait for providing mapping results for a given instruction.

This provides virtual to real register mappings for every mention in an instruction: use, mod or def. The main purpose of this trait is to be used when re-writing the instruction stream after register allocation happened; see also Function::map_regs.

Required Methods§

Source

fn get_use(&self, vreg: VirtualReg) -> Option<RealReg>

Return the RealReg if mapped, or None, for vreg occuring as a use on the current instruction.

Source

fn get_def(&self, vreg: VirtualReg) -> Option<RealReg>

Return the RealReg if mapped, or None, for vreg occuring as a def on the current instruction.

Source

fn get_mod(&self, vreg: VirtualReg) -> Option<RealReg>

Return the RealReg if mapped, or None, for a vreg occuring as a mod on the current instruction.

Implementors§