/// Encode an instruction after determining it is legal.
///
/// If `inst` can legally be encoded in this ISA, produce the corresponding `Encoding` object.
/// Otherwise, return `Legalize` action.
///
/// This is also the main entry point for determining if an instruction is legal.
Encode an instruction after determining it is legal.
If `inst` can legally be encoded in this ISA, produce the corresponding `Encoding` object.
Otherwise, return `Legalize` action.

This is also the main entry point for determining if an instruction is legal.
Encode an instruction after determining it is legal . If ` inst ` can legally be encoded in this ISA produce the corresponding ` Encoding ` object . Otherwise return ` Legalize ` action . This is also the main entry point for determining if an instruction is legal .
fn encode(
        &self,
        func: &ir::Function,
        inst: &ir::InstructionData,
        ctrl_typevar: ir::Type,
    ) -> Result<Encoding, Legalize> {
        let mut iter = self.legal_encodings(func, inst, ctrl_typevar);
        iter.next().ok_or_else(|| iter.legalize())
    }
fn encode ( & self , func : & ir :: Function , inst : & ir :: InstructionData , ctrl_typevar : ir :: Type , ) -> Result < Encoding , Legalize > { let mut iter = self . legal_encodings ( func , inst , ctrl_typevar ) ; iter . next ( ) . ok_or_else ( | | iter . legalize ( ) ) }
Encode an instruction after determining it is legal.
Encode an instruction after determining it is legal .
&self
func
&ir::Function
inst
&ir::InstructionData
ctrl_typevar
ir::Type