Trait regalloc::RegUsageMapper
source · [−]pub trait RegUsageMapper: Debug {
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
fn get_use(&self, vreg: VirtualReg) -> Option<RealReg>
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.
fn get_def(&self, vreg: VirtualReg) -> Option<RealReg>
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.
fn get_mod(&self, vreg: VirtualReg) -> Option<RealReg>
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.