use crate::assembly::{FlowType, InstructionCategory, OperandType};
pub struct CilInstruction<'a> {
pub op_type: OperandType,
pub instr: &'a str,
pub category: InstructionCategory,
pub stack_pops: u8,
pub stack_pushes: u8,
pub flow: FlowType,
}
pub const INSTRUCTIONS_MAX: u8 = 225;
pub const INSTRUCTIONS: [CilInstruction; INSTRUCTIONS_MAX as usize] = [
CilInstruction {
op_type: OperandType::None,
instr: "nop",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "break",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldarg.0",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldarg.1",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldarg.2",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldarg.3",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldloc.0",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldloc.1",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldloc.2",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldloc.3",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stloc.0",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stloc.1",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stloc.2",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stloc.3",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::UInt8,
instr: "ldarg.s",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::UInt8,
instr: "ldarga.s",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::UInt8,
instr: "starg.s",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::UInt8,
instr: "ldloc.s",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::UInt8,
instr: "ldloca.s",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::UInt8,
instr: "stloc.s",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldnull",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldc.i4.m1",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldc.i4.0",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldc.i4.1",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldc.i4.2",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldc.i4.3",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldc.i4.4",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldc.i4.5",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldc.i4.6",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldc.i4.7",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldc.i4.8",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "ldc.i4.s",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "ldc.i4",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Int64,
instr: "ldc.i8",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Float32,
instr: "ldc.r4",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Float64,
instr: "ldc.r8",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "dup",
category: InstructionCategory::Misc,
stack_pops: 1,
stack_pushes: 2,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "pop",
category: InstructionCategory::Misc,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "jmp",
category: InstructionCategory::ControlFlow,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Call,
},
CilInstruction {
op_type: OperandType::Token,
instr: "call",
category: InstructionCategory::ControlFlow,
stack_pops: 0, stack_pushes: 0, flow: FlowType::Call,
},
CilInstruction {
op_type: OperandType::Token,
instr: "calli",
category: InstructionCategory::ControlFlow,
stack_pops: 0, stack_pushes: 0, flow: FlowType::Call,
},
CilInstruction {
op_type: OperandType::None,
instr: "ret",
category: InstructionCategory::ControlFlow,
stack_pops: 0, stack_pushes: 0,
flow: FlowType::Return,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "br.s",
category: InstructionCategory::ControlFlow,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::UnconditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "brfalse.s",
category: InstructionCategory::ControlFlow,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "brtrue.s",
category: InstructionCategory::ControlFlow,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "beq.s",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "bge.s",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "bgt.s",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "ble.s",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "blt.s",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "bne.un.s",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "bge.un.s",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "bgt.un.s",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "ble.un.s",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "blt.un.s",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "br",
category: InstructionCategory::ControlFlow,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::UnconditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "brfalse",
category: InstructionCategory::ControlFlow,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "brtrue",
category: InstructionCategory::ControlFlow,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "beq",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "bge",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "bgt",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "ble",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "blt",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "bne.un",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "bge.un",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "bgt.un",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "ble.un",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "blt.un",
category: InstructionCategory::ControlFlow,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::ConditionalBranch,
},
CilInstruction {
op_type: OperandType::Switch,
instr: "switch",
category: InstructionCategory::ControlFlow,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Switch,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.i1",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.u1",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.i2",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.u2",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.i4",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.u4",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.i8",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.i",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.r4",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.r8",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldind.ref",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stind.ref",
category: InstructionCategory::LoadStore,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stind.i1",
category: InstructionCategory::LoadStore,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stind.i2",
category: InstructionCategory::LoadStore,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stind.i4",
category: InstructionCategory::LoadStore,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stind.i8",
category: InstructionCategory::LoadStore,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stind.r4",
category: InstructionCategory::LoadStore,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stind.r8",
category: InstructionCategory::LoadStore,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "add",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "sub",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "mul",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "div",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "div.un",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "rem",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "rem.un",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "and",
category: InstructionCategory::BitwiseLogical,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "or",
category: InstructionCategory::BitwiseLogical,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "xor",
category: InstructionCategory::BitwiseLogical,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "shl",
category: InstructionCategory::BitwiseLogical,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "shr",
category: InstructionCategory::BitwiseLogical,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "shr.un",
category: InstructionCategory::BitwiseLogical,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "neg",
category: InstructionCategory::Arithmetic,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "not",
category: InstructionCategory::BitwiseLogical,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.i1",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.i2",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.i4",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.i8",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.r4",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.r8",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.u4",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.u8",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "callvirt",
category: InstructionCategory::ControlFlow,
stack_pops: 0, stack_pushes: 0, flow: FlowType::Call,
},
CilInstruction {
op_type: OperandType::Token,
instr: "cpobj",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldobj",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldstr",
category: InstructionCategory::ObjectModel,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "newobj",
category: InstructionCategory::ObjectModel,
stack_pops: 0, stack_pushes: 1,
flow: FlowType::Call,
},
CilInstruction {
op_type: OperandType::Token,
instr: "castclass",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "isinst",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.r.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "unbox",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "throw",
category: InstructionCategory::ControlFlow,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Throw,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldfld",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldflda",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "stfld",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldsfld",
category: InstructionCategory::ObjectModel,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldsflda",
category: InstructionCategory::ObjectModel,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "stsfld",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "stobj",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.i1.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.i2.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.i4.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.i8.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.u1.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.u2.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.u4.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.u8.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.i.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.u.un",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "box",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "newarr",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldlen",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldelema",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.i1",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.u1",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.i2",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.u2",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.i4",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.u4",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.i8",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.i",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.r4",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.r8",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ldelem.ref",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stelem.i",
category: InstructionCategory::ObjectModel,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stelem.i1",
category: InstructionCategory::ObjectModel,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stelem.i2",
category: InstructionCategory::ObjectModel,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stelem.i4",
category: InstructionCategory::ObjectModel,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stelem.i8",
category: InstructionCategory::ObjectModel,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stelem.r4",
category: InstructionCategory::ObjectModel,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stelem.r8",
category: InstructionCategory::ObjectModel,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "stelem.ref",
category: InstructionCategory::ObjectModel,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldelem",
category: InstructionCategory::ObjectModel,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "stelem",
category: InstructionCategory::ObjectModel,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "unbox.any",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.i1",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.u1",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.i2",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.u2",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.i4",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.u4",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.i8",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.u8",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "refanyval",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ckfinite",
category: InstructionCategory::Misc,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "mkrefany",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldtoken",
category: InstructionCategory::ObjectModel,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.u2",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.u1",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.i",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.i",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.ovf.u",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "add.ovf",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "add.ovf.un",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "mul.ovf",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "mul.ovf.un",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "sub.ovf",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "sub.ovf.un",
category: InstructionCategory::Arithmetic,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "endfinally",
category: InstructionCategory::ControlFlow,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::EndFinally,
},
CilInstruction {
op_type: OperandType::Int32,
instr: "leave",
category: InstructionCategory::ControlFlow,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Leave,
},
CilInstruction {
op_type: OperandType::Int8,
instr: "leave.s",
category: InstructionCategory::ControlFlow,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Leave,
},
CilInstruction {
op_type: OperandType::None,
instr: "stind.i",
category: InstructionCategory::LoadStore,
stack_pops: 2,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "conv.u",
category: InstructionCategory::Conversion,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
];
pub const INSTRUCTIONS_FE_MAX: u8 = 31;
pub const INSTRUCTIONS_FE: [CilInstruction; INSTRUCTIONS_FE_MAX as usize] = [
CilInstruction {
op_type: OperandType::None,
instr: "arglist",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "ceq",
category: InstructionCategory::Comparison,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "cgt",
category: InstructionCategory::Comparison,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "cgt.un",
category: InstructionCategory::Comparison,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "clt",
category: InstructionCategory::Comparison,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "clt.un",
category: InstructionCategory::Comparison,
stack_pops: 2,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldftn",
category: InstructionCategory::ObjectModel,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "ldvirtftn",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Int16,
instr: "ldarg",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Int16,
instr: "ldarga",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Int16,
instr: "starg",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Int16,
instr: "ldloc",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Int16,
instr: "ldloca",
category: InstructionCategory::LoadStore,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Int16,
instr: "stloc",
category: InstructionCategory::LoadStore,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "localloc",
category: InstructionCategory::Misc,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "endfilter",
category: InstructionCategory::ControlFlow,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::EndFinally,
},
CilInstruction {
op_type: OperandType::UInt8,
instr: "unaligned.",
category: InstructionCategory::Prefix,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "volatile.",
category: InstructionCategory::Prefix,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "tail.",
category: InstructionCategory::Prefix,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "initobj",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "constrained.",
category: InstructionCategory::Prefix,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "cpblk",
category: InstructionCategory::Misc,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "initblk",
category: InstructionCategory::Misc,
stack_pops: 3,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "rethrow",
category: InstructionCategory::ControlFlow,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Throw,
},
CilInstruction {
op_type: OperandType::None,
instr: "",
category: InstructionCategory::Misc,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::Token,
instr: "sizeof",
category: InstructionCategory::ObjectModel,
stack_pops: 0,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "refanytype",
category: InstructionCategory::ObjectModel,
stack_pops: 1,
stack_pushes: 1,
flow: FlowType::Sequential,
},
CilInstruction {
op_type: OperandType::None,
instr: "readonly.",
category: InstructionCategory::Prefix,
stack_pops: 0,
stack_pushes: 0,
flow: FlowType::Sequential,
},
];
#[must_use]
pub fn il_instruction_size(il_bytes: &[u8], offset: usize) -> usize {
if offset >= il_bytes.len() {
return 0;
}
let opcode = il_bytes[offset];
if opcode == 0xFE {
if offset + 1 >= il_bytes.len() {
return 1; }
let second_byte = il_bytes[offset + 1];
if (second_byte as usize) < INSTRUCTIONS_FE.len() {
let operand_size = INSTRUCTIONS_FE[second_byte as usize]
.op_type
.size()
.unwrap_or(0);
return 2 + operand_size; }
return 2; }
if opcode == 0x45 {
return switch_instruction_size(il_bytes, offset);
}
if (opcode as usize) < INSTRUCTIONS.len() {
let operand_size = INSTRUCTIONS[opcode as usize].op_type.size().unwrap_or(0);
return 1 + operand_size;
}
1 }
#[inline]
#[must_use]
pub fn switch_instruction_size(il_bytes: &[u8], offset: usize) -> usize {
if offset + 5 > il_bytes.len() {
return 1; }
let count = u32::from_le_bytes([
il_bytes[offset + 1],
il_bytes[offset + 2],
il_bytes[offset + 3],
il_bytes[offset + 4],
]) as usize;
1 + 4 + (count * 4) }