fn to_temp_reg(&mut self, ty: impl Into<Option<GPRType>>, val: ValueLocation) -> Option<GPR> {
        // If we have `None` as the type then it always matches (`.unwrap_or(true)`)
        match val {
            ValueLocation::Reg(r) => {
                let ty = ty.into();
                let type_matches = ty.map(|t| t == r.type_()).unwrap_or(true);

                if self.block_state.regs.num_usages(r) <= 1 && type_matches {
                    self.block_state.regs.mark_used(r);
                    Some(r)
                } else {
                    let scratch = self.take_reg(ty.unwrap_or(GPRType::Rq))?;

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

                    Some(scratch)
                }
            }
            val => self.to_reg(ty, val),
        }
    }
/// Clones this value into a temporary register so that operations
/// on that register don't write to a local.
Clones this value into a temporary register so that operations
on that register don't write to a local.
Clones this value into a temporary register so that operations on that register don ' t write to a local .
fn to_temp_reg(&mut self, ty: impl Into<Option<GPRType>>, val: ValueLocation) -> Option<GPR> {
        // If we have `None` as the type then it always matches (`.unwrap_or(true)`)
        match val {
            ValueLocation::Reg(r) => {
                let ty = ty.into();
                let type_matches = ty.map(|t| t == r.type_()).unwrap_or(true);
                if self.block_state.regs.num_usages(r) <= 1 && type_matches {
                    self.block_state.regs.mark_used(r);
                    Some(r)
                } else {
                    let scratch = self.take_reg(ty.unwrap_or(GPRType::Rq))?;
                    self.copy_value(val, CCLoc::Reg(scratch));
                    Some(scratch)
                }
            }
            val => self.to_reg(ty, val),
        }
    }
fn to_temp_reg ( & mut self , ty : impl Into < Option < GPRType > > , val : ValueLocation ) -> Option < GPR > { // If we have `None` as the type then it always matches (`.unwrap_or(true)`) match val { ValueLocation :: Reg ( r ) => { let ty = ty . into ( ) ; let type_matches = ty . map ( | t | t == r . type_ ( ) ) . unwrap_or ( true ) ; if self . block_state . regs . num_usages ( r ) <= 1 && type_matches { self . block_state . regs . mark_used ( r ) ; Some ( r ) } else { let scratch = self . take_reg ( ty . unwrap_or ( GPRType :: Rq ) ) ? ; self . copy_value ( val , CCLoc :: Reg ( scratch ) ) ; Some ( scratch ) } } val => self . to_reg ( ty , val ) , } }
Clones this value into a temporary register so that operations
on that register don't write to a local.
Clones this value into a temporary register so that operations on that register don ' t write to a local .
&mut self
ty
impl Into<Option<GPRType>>
val
ValueLocation