fn to_reg(&mut self, ty: impl Into<Option<GPRType>>, val: ValueLocation) -> Option<GPR> {
        let ty = ty.into();
        match val {
            ValueLocation::Reg(r) if ty.map(|t| t == r.type_()).unwrap_or(true) => {
                self.block_state.regs.mark_used(r);
                Some(r)
            }
            val => {
                let scratch = self.take_reg(ty.unwrap_or(GPRType::Rq))?;

                self.copy_value(val, CCLoc::Reg(scratch));

                Some(scratch)
            }
        }
    }
/// Clones this value into a register so that it can be efficiently read
Clones this value into a register so that it can be efficiently read
Clones this value into a register so that it can be efficiently read
fn to_reg(&mut self, ty: impl Into<Option<GPRType>>, val: ValueLocation) -> Option<GPR> {
        let ty = ty.into();
        match val {
            ValueLocation::Reg(r) if ty.map(|t| t == r.type_()).unwrap_or(true) => {
                self.block_state.regs.mark_used(r);
                Some(r)
            }
            val => {
                let scratch = self.take_reg(ty.unwrap_or(GPRType::Rq))?;
                self.copy_value(val, CCLoc::Reg(scratch));
                Some(scratch)
            }
        }
    }
fn to_reg ( & mut self , ty : impl Into < Option < GPRType > > , val : ValueLocation ) -> Option < GPR > { let ty = ty . into ( ) ; match val { ValueLocation :: Reg ( r ) if ty . map ( | t | t == r . type_ ( ) ) . unwrap_or ( true ) => { self . block_state . regs . mark_used ( r ) ; Some ( r ) } val => { let scratch = self . take_reg ( ty . unwrap_or ( GPRType :: Rq ) ) ? ; self . copy_value ( val , CCLoc :: Reg ( scratch ) ) ; Some ( scratch ) } } }
Clones this value into a register so that it can be efficiently read
Clones this value into a register so that it can be efficiently read
&mut self
ty
impl Into<Option<GPRType>>
val
ValueLocation