Introduction
Every CIL opcode, in order, with the facts the runtime library’s opcode table records about it. The first section is the one-byte opcodes; the second the two-byte ones, which start with
FE. The columns are:
- Operand – what follows the opcode (the kinds are on the overview).
- Pops and Pushes – the evaluation-stack behaviour:
Pop0nothing,Pop1one value of any kind,Popian integer (an address or anint32),Poprefan object reference, and combinations such asPopref_popi(an array and an index) andPop1_pop1(two values, the later one on top);VarpopandVarpushdepend on a signature.Push1is a value of any kind,Pushian integer,Pushi8anint64,Pushr4andPushr8floating point,Pushrefan object reference,Push1_push1two copies. - Flow – how control continues:
Nextto the next instruction,Branchto a target only,Cond_Branchto a target or the next instruction,Callinto a method and back,Return,Throw,Break(to the debugger) andMeta(a prefix: it only qualifies the next instruction). - Type –
Primitivefor an instruction with its own meaning,Macrofor a short form of another instruction,Objmodelfor the object-model instructions,Prefixfor a prefix andNternalfor the reserved bytes (the spelling is the library’s).
The names link to the entry on the instruction’s page. Unused single-byte values (24, 77, 78, A6 to B2, BB to C1, C4, C5,
C7 to CF, E1 to F7) and the unused values after FE (08, 10, 1B and everything from 1F) are not opcodes; the explorer decodes such a
byte as a one-byte (or, after FE, two-byte) .byte item and reports it.
One-byte opcodes
| Opcode | Name | Operand | Pops | Pushes | Flow | Type |
|---|---|---|---|---|---|---|
00 | nop | none | Pop0 | Push0 | Next | Primitive |
01 | break | none | Pop0 | Push0 | Break | Primitive |
02 | ldarg.0 | none | Pop0 | Push1 | Next | Macro |
03 | ldarg.1 | none | Pop0 | Push1 | Next | Macro |
04 | ldarg.2 | none | Pop0 | Push1 | Next | Macro |
05 | ldarg.3 | none | Pop0 | Push1 | Next | Macro |
06 | ldloc.0 | none | Pop0 | Push1 | Next | Macro |
07 | ldloc.1 | none | Pop0 | Push1 | Next | Macro |
08 | ldloc.2 | none | Pop0 | Push1 | Next | Macro |
09 | ldloc.3 | none | Pop0 | Push1 | Next | Macro |
0A | stloc.0 | none | Pop1 | Push0 | Next | Macro |
0B | stloc.1 | none | Pop1 | Push0 | Next | Macro |
0C | stloc.2 | none | Pop1 | Push0 | Next | Macro |
0D | stloc.3 | none | Pop1 | Push0 | Next | Macro |
0E | ldarg.s | ShortInlineVar | Pop0 | Push1 | Next | Macro |
0F | ldarga.s | ShortInlineVar | Pop0 | Pushi | Next | Macro |
10 | starg.s | ShortInlineVar | Pop1 | Push0 | Next | Macro |
11 | ldloc.s | ShortInlineVar | Pop0 | Push1 | Next | Macro |
12 | ldloca.s | ShortInlineVar | Pop0 | Pushi | Next | Macro |
13 | stloc.s | ShortInlineVar | Pop1 | Push0 | Next | Macro |
14 | ldnull | none | Pop0 | Pushref | Next | Primitive |
15 | ldc.i4.m1 | none | Pop0 | Pushi | Next | Macro |
16 | ldc.i4.0 | none | Pop0 | Pushi | Next | Macro |
17 | ldc.i4.1 | none | Pop0 | Pushi | Next | Macro |
18 | ldc.i4.2 | none | Pop0 | Pushi | Next | Macro |
19 | ldc.i4.3 | none | Pop0 | Pushi | Next | Macro |
1A | ldc.i4.4 | none | Pop0 | Pushi | Next | Macro |
1B | ldc.i4.5 | none | Pop0 | Pushi | Next | Macro |
1C | ldc.i4.6 | none | Pop0 | Pushi | Next | Macro |
1D | ldc.i4.7 | none | Pop0 | Pushi | Next | Macro |
1E | ldc.i4.8 | none | Pop0 | Pushi | Next | Macro |
1F | ldc.i4.s | ShortInlineI | Pop0 | Pushi | Next | Macro |
20 | ldc.i4 | InlineI | Pop0 | Pushi | Next | Primitive |
21 | ldc.i8 | InlineI8 | Pop0 | Pushi8 | Next | Primitive |
22 | ldc.r4 | ShortInlineR | Pop0 | Pushr4 | Next | Primitive |
23 | ldc.r8 | InlineR | Pop0 | Pushr8 | Next | Primitive |
25 | dup | none | Pop1 | Push1_push1 | Next | Primitive |
26 | pop | none | Pop1 | Push0 | Next | Primitive |
27 | jmp | InlineMethod | Pop0 | Push0 | Call | Primitive |
28 | call | InlineMethod | Varpop | Varpush | Call | Primitive |
29 | calli | InlineSig | Varpop | Varpush | Call | Primitive |
2A | ret | none | Varpop | Push0 | Return | Primitive |
2B | br.s | ShortInlineBrTarget | Pop0 | Push0 | Branch | Macro |
2C | brfalse.s | ShortInlineBrTarget | Popi | Push0 | Cond_Branch | Macro |
2D | brtrue.s | ShortInlineBrTarget | Popi | Push0 | Cond_Branch | Macro |
2E | beq.s | ShortInlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
2F | bge.s | ShortInlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
30 | bgt.s | ShortInlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
31 | ble.s | ShortInlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
32 | blt.s | ShortInlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
33 | bne.un.s | ShortInlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
34 | bge.un.s | ShortInlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
35 | bgt.un.s | ShortInlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
36 | ble.un.s | ShortInlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
37 | blt.un.s | ShortInlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
38 | br | InlineBrTarget | Pop0 | Push0 | Branch | Primitive |
39 | brfalse | InlineBrTarget | Popi | Push0 | Cond_Branch | Primitive |
3A | brtrue | InlineBrTarget | Popi | Push0 | Cond_Branch | Primitive |
3B | beq | InlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
3C | bge | InlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
3D | bgt | InlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
3E | ble | InlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
3F | blt | InlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
40 | bne.un | InlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
41 | bge.un | InlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
42 | bgt.un | InlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
43 | ble.un | InlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
44 | blt.un | InlineBrTarget | Pop1_pop1 | Push0 | Cond_Branch | Macro |
45 | switch | InlineSwitch | Popi | Push0 | Cond_Branch | Primitive |
46 | ldind.i1 | none | Popi | Pushi | Next | Primitive |
47 | ldind.u1 | none | Popi | Pushi | Next | Primitive |
48 | ldind.i2 | none | Popi | Pushi | Next | Primitive |
49 | ldind.u2 | none | Popi | Pushi | Next | Primitive |
4A | ldind.i4 | none | Popi | Pushi | Next | Primitive |
4B | ldind.u4 | none | Popi | Pushi | Next | Primitive |
4C | ldind.i8 | none | Popi | Pushi8 | Next | Primitive |
4D | ldind.i | none | Popi | Pushi | Next | Primitive |
4E | ldind.r4 | none | Popi | Pushr4 | Next | Primitive |
4F | ldind.r8 | none | Popi | Pushr8 | Next | Primitive |
50 | ldind.ref | none | Popi | Pushref | Next | Primitive |
51 | stind.ref | none | Popi_popi | Push0 | Next | Primitive |
52 | stind.i1 | none | Popi_popi | Push0 | Next | Primitive |
53 | stind.i2 | none | Popi_popi | Push0 | Next | Primitive |
54 | stind.i4 | none | Popi_popi | Push0 | Next | Primitive |
55 | stind.i8 | none | Popi_popi8 | Push0 | Next | Primitive |
56 | stind.r4 | none | Popi_popr4 | Push0 | Next | Primitive |
57 | stind.r8 | none | Popi_popr8 | Push0 | Next | Primitive |
58 | add | none | Pop1_pop1 | Push1 | Next | Primitive |
59 | sub | none | Pop1_pop1 | Push1 | Next | Primitive |
5A | mul | none | Pop1_pop1 | Push1 | Next | Primitive |
5B | div | none | Pop1_pop1 | Push1 | Next | Primitive |
5C | div.un | none | Pop1_pop1 | Push1 | Next | Primitive |
5D | rem | none | Pop1_pop1 | Push1 | Next | Primitive |
5E | rem.un | none | Pop1_pop1 | Push1 | Next | Primitive |
5F | and | none | Pop1_pop1 | Push1 | Next | Primitive |
60 | or | none | Pop1_pop1 | Push1 | Next | Primitive |
61 | xor | none | Pop1_pop1 | Push1 | Next | Primitive |
62 | shl | none | Pop1_pop1 | Push1 | Next | Primitive |
63 | shr | none | Pop1_pop1 | Push1 | Next | Primitive |
64 | shr.un | none | Pop1_pop1 | Push1 | Next | Primitive |
65 | neg | none | Pop1 | Push1 | Next | Primitive |
66 | not | none | Pop1 | Push1 | Next | Primitive |
67 | conv.i1 | none | Pop1 | Pushi | Next | Primitive |
68 | conv.i2 | none | Pop1 | Pushi | Next | Primitive |
69 | conv.i4 | none | Pop1 | Pushi | Next | Primitive |
6A | conv.i8 | none | Pop1 | Pushi8 | Next | Primitive |
6B | conv.r4 | none | Pop1 | Pushr4 | Next | Primitive |
6C | conv.r8 | none | Pop1 | Pushr8 | Next | Primitive |
6D | conv.u4 | none | Pop1 | Pushi | Next | Primitive |
6E | conv.u8 | none | Pop1 | Pushi8 | Next | Primitive |
6F | callvirt | InlineMethod | Varpop | Varpush | Call | Objmodel |
70 | cpobj | InlineType | Popi_popi | Push0 | Next | Objmodel |
71 | ldobj | InlineType | Popi | Push1 | Next | Objmodel |
72 | ldstr | InlineString | Pop0 | Pushref | Next | Objmodel |
73 | newobj | InlineMethod | Varpop | Pushref | Call | Objmodel |
74 | castclass | InlineType | Popref | Pushref | Next | Objmodel |
75 | isinst | InlineType | Popref | Pushi | Next | Objmodel |
76 | conv.r.un | none | Pop1 | Pushr8 | Next | Primitive |
79 | unbox | InlineType | Popref | Pushi | Next | Primitive |
7A | throw | none | Popref | Push0 | Throw | Objmodel |
7B | ldfld | InlineField | Popref | Push1 | Next | Objmodel |
7C | ldflda | InlineField | Popref | Pushi | Next | Objmodel |
7D | stfld | InlineField | Popref_pop1 | Push0 | Next | Objmodel |
7E | ldsfld | InlineField | Pop0 | Push1 | Next | Objmodel |
7F | ldsflda | InlineField | Pop0 | Pushi | Next | Objmodel |
80 | stsfld | InlineField | Pop1 | Push0 | Next | Objmodel |
81 | stobj | InlineType | Popi_pop1 | Push0 | Next | Primitive |
82 | conv.ovf.i1.un | none | Pop1 | Pushi | Next | Primitive |
83 | conv.ovf.i2.un | none | Pop1 | Pushi | Next | Primitive |
84 | conv.ovf.i4.un | none | Pop1 | Pushi | Next | Primitive |
85 | conv.ovf.i8.un | none | Pop1 | Pushi8 | Next | Primitive |
86 | conv.ovf.u1.un | none | Pop1 | Pushi | Next | Primitive |
87 | conv.ovf.u2.un | none | Pop1 | Pushi | Next | Primitive |
88 | conv.ovf.u4.un | none | Pop1 | Pushi | Next | Primitive |
89 | conv.ovf.u8.un | none | Pop1 | Pushi8 | Next | Primitive |
8A | conv.ovf.i.un | none | Pop1 | Pushi | Next | Primitive |
8B | conv.ovf.u.un | none | Pop1 | Pushi | Next | Primitive |
8C | box | InlineType | Pop1 | Pushref | Next | Primitive |
8D | newarr | InlineType | Popi | Pushref | Next | Objmodel |
8E | ldlen | none | Popref | Pushi | Next | Objmodel |
8F | ldelema | InlineType | Popref_popi | Pushi | Next | Objmodel |
90 | ldelem.i1 | none | Popref_popi | Pushi | Next | Objmodel |
91 | ldelem.u1 | none | Popref_popi | Pushi | Next | Objmodel |
92 | ldelem.i2 | none | Popref_popi | Pushi | Next | Objmodel |
93 | ldelem.u2 | none | Popref_popi | Pushi | Next | Objmodel |
94 | ldelem.i4 | none | Popref_popi | Pushi | Next | Objmodel |
95 | ldelem.u4 | none | Popref_popi | Pushi | Next | Objmodel |
96 | ldelem.i8 | none | Popref_popi | Pushi8 | Next | Objmodel |
97 | ldelem.i | none | Popref_popi | Pushi | Next | Objmodel |
98 | ldelem.r4 | none | Popref_popi | Pushr4 | Next | Objmodel |
99 | ldelem.r8 | none | Popref_popi | Pushr8 | Next | Objmodel |
9A | ldelem.ref | none | Popref_popi | Pushref | Next | Objmodel |
9B | stelem.i | none | Popref_popi_popi | Push0 | Next | Objmodel |
9C | stelem.i1 | none | Popref_popi_popi | Push0 | Next | Objmodel |
9D | stelem.i2 | none | Popref_popi_popi | Push0 | Next | Objmodel |
9E | stelem.i4 | none | Popref_popi_popi | Push0 | Next | Objmodel |
9F | stelem.i8 | none | Popref_popi_popi8 | Push0 | Next | Objmodel |
A0 | stelem.r4 | none | Popref_popi_popr4 | Push0 | Next | Objmodel |
A1 | stelem.r8 | none | Popref_popi_popr8 | Push0 | Next | Objmodel |
A2 | stelem.ref | none | Popref_popi_popref | Push0 | Next | Objmodel |
A3 | ldelem | InlineType | Popref_popi | Push1 | Next | Objmodel |
A4 | stelem | InlineType | Popref_popi_pop1 | Push0 | Next | Objmodel |
A5 | unbox.any | InlineType | Popref | Push1 | Next | Objmodel |
B3 | conv.ovf.i1 | none | Pop1 | Pushi | Next | Primitive |
B4 | conv.ovf.u1 | none | Pop1 | Pushi | Next | Primitive |
B5 | conv.ovf.i2 | none | Pop1 | Pushi | Next | Primitive |
B6 | conv.ovf.u2 | none | Pop1 | Pushi | Next | Primitive |
B7 | conv.ovf.i4 | none | Pop1 | Pushi | Next | Primitive |
B8 | conv.ovf.u4 | none | Pop1 | Pushi | Next | Primitive |
B9 | conv.ovf.i8 | none | Pop1 | Pushi8 | Next | Primitive |
BA | conv.ovf.u8 | none | Pop1 | Pushi8 | Next | Primitive |
C2 | refanyval | InlineType | Pop1 | Pushi | Next | Primitive |
C3 | ckfinite | none | Pop1 | Pushr8 | Next | Primitive |
C6 | mkrefany | InlineType | Popi | Push1 | Next | Primitive |
D0 | ldtoken | InlineTok | Pop0 | Pushi | Next | Primitive |
D1 | conv.u2 | none | Pop1 | Pushi | Next | Primitive |
D2 | conv.u1 | none | Pop1 | Pushi | Next | Primitive |
D3 | conv.i | none | Pop1 | Pushi | Next | Primitive |
D4 | conv.ovf.i | none | Pop1 | Pushi | Next | Primitive |
D5 | conv.ovf.u | none | Pop1 | Pushi | Next | Primitive |
D6 | add.ovf | none | Pop1_pop1 | Push1 | Next | Primitive |
D7 | add.ovf.un | none | Pop1_pop1 | Push1 | Next | Primitive |
D8 | mul.ovf | none | Pop1_pop1 | Push1 | Next | Primitive |
D9 | mul.ovf.un | none | Pop1_pop1 | Push1 | Next | Primitive |
DA | sub.ovf | none | Pop1_pop1 | Push1 | Next | Primitive |
DB | sub.ovf.un | none | Pop1_pop1 | Push1 | Next | Primitive |
DC | endfinally | none | Pop0 | Push0 | Return | Primitive |
DD | leave | InlineBrTarget | Pop0 | Push0 | Branch | Primitive |
DE | leave.s | ShortInlineBrTarget | Pop0 | Push0 | Branch | Primitive |
DF | stind.i | none | Popi_popi | Push0 | Next | Primitive |
E0 | conv.u | none | Pop1 | Pushi | Next | Primitive |
F8 | prefix7 | none | Pop0 | Push0 | Meta | Nternal |
F9 | prefix6 | none | Pop0 | Push0 | Meta | Nternal |
FA | prefix5 | none | Pop0 | Push0 | Meta | Nternal |
FB | prefix4 | none | Pop0 | Push0 | Meta | Nternal |
FC | prefix3 | none | Pop0 | Push0 | Meta | Nternal |
FD | prefix2 | none | Pop0 | Push0 | Meta | Nternal |
FE | prefix1 | none | Pop0 | Push0 | Meta | Nternal |
FF | prefixref | none | Pop0 | Push0 | Meta | Nternal |
Two-byte opcodes (first byte FE)
| Opcode | Name | Operand | Pops | Pushes | Flow | Type |
|---|---|---|---|---|---|---|
FE 00 | arglist | none | Pop0 | Pushi | Next | Primitive |
FE 01 | ceq | none | Pop1_pop1 | Pushi | Next | Primitive |
FE 02 | cgt | none | Pop1_pop1 | Pushi | Next | Primitive |
FE 03 | cgt.un | none | Pop1_pop1 | Pushi | Next | Primitive |
FE 04 | clt | none | Pop1_pop1 | Pushi | Next | Primitive |
FE 05 | clt.un | none | Pop1_pop1 | Pushi | Next | Primitive |
FE 06 | ldftn | InlineMethod | Pop0 | Pushi | Next | Primitive |
FE 07 | ldvirtftn | InlineMethod | Popref | Pushi | Next | Primitive |
FE 09 | ldarg | InlineVar | Pop0 | Push1 | Next | Primitive |
FE 0A | ldarga | InlineVar | Pop0 | Pushi | Next | Primitive |
FE 0B | starg | InlineVar | Pop1 | Push0 | Next | Primitive |
FE 0C | ldloc | InlineVar | Pop0 | Push1 | Next | Primitive |
FE 0D | ldloca | InlineVar | Pop0 | Pushi | Next | Primitive |
FE 0E | stloc | InlineVar | Pop1 | Push0 | Next | Primitive |
FE 0F | localloc | none | Popi | Pushi | Next | Primitive |
FE 11 | endfilter | none | Popi | Push0 | Return | Primitive |
FE 12 | unaligned. | ShortInlineI | Pop0 | Push0 | Meta | Prefix |
FE 13 | volatile. | none | Pop0 | Push0 | Meta | Prefix |
FE 14 | tail. | none | Pop0 | Push0 | Meta | Prefix |
FE 15 | initobj | InlineType | Popi | Push0 | Next | Objmodel |
FE 16 | constrained. | InlineType | Pop0 | Push0 | Meta | Prefix |
FE 17 | cpblk | none | Popi_popi_popi | Push0 | Next | Primitive |
FE 18 | initblk | none | Popi_popi_popi | Push0 | Next | Primitive |
FE 19 | no. (not in System.Reflection.Emit) | ShortInlineI | Pop0 | Push0 | Meta | Prefix |
FE 1A | rethrow | none | Pop0 | Push0 | Throw | Objmodel |
FE 1C | sizeof | InlineType | Pop0 | Pushi | Next | Primitive |
FE 1D | refanytype | none | Pop1 | Pushi | Next | Primitive |
FE 1E | readonly. | none | Pop0 | Push0 | Meta | Prefix |
Not described
Known, not yet covered
- Per-runtime acceptance: the table is the runtime library’s (checked against it, field by field, plus
no.from the specification); which runtime version accepts which opcode was not checked.
Unknown
- None found.
Links
Reference
- ECMA-335 – partition III, the instruction set
- System.Reflection.Emit.OpCodes – the runtime library’s table of every opcode, the source of this page’s columns (.NET)