Annex C CIL Assembler Implementation


This section contains only informative text.


This section provides information about a particular assembler for CIL, called ilasm. It supports a superset of the syntax defined normatively in Partition II, sections 1 20, and it provides a concrete syntax for the CIL instructions specified in Partition III.

Even for those who have no interest in this particular assembler, Partition V, sections C.1 and C.2 may prove of interest. The former is a machine-readable file (ready for input to a C or C++ preprocessor) that partially describes the CIL instructions. It can be used to generate tables for use by a wide variety of tools that deal with CIL. The latter contains a concrete syntax for CIL instructions, which is not described elsewhere.

C.1 ilasm Keywords

This section provides a complete list of the keywords used by ilasm. If users wish to use any of these as simple identifiers within programs, they just make use of the appropriate escape notation (single or double quotation marks as specified in the grammar). This assembler is case-sensitive.

ANNOTATION

Implementation-Specific (Microsoft): The table below consists of the contents of the file include\il_kywd.h from the SDK and the names of all opcodes mentioned in include\opcode.def from the Microsoft .NET SDK.


#line

.module

algorithm

blob

.addon

.mresource

alignment

blob_object

.assembly

.namespace

and

blt

.cctor

.other

ansi

blt.s

.class

.override

any

blt.un

.corflags

.pack

arglist

blt.un.s

.ctor

.param

array

bne.un

.custom

.pdirect

as

bne.un.s

.data

.permission

assembly

bool

.emitbyte

.permissionset

assert

box

.entrypoint

.property

at

br

.event

.publickey

auto

br.s

.export

.publickeytoken

autochar

break

.field

.removeon

beforefieldinit

brfalse

.file

.set

beq

brfalse.s

.fire

.size

beq.s

brinst

.get

.subsystem

bge

brinst.s

.hash

.try

bge.s

brnull

.imagebase

.ver

bge.un

brnull.s

.import

.vtable

bge.un.s

brtrue

.language

.vtentry

bgt

brtrue.s

.line

.vtfixup

bgt.s

brzero

.locale

.zeroinit

bgt.un

brzero.s

.localized

^THE_END^

bgt.un.s

bstr

.locals

abstract

ble

bytearray

.manifestres

add

ble.s

byvalstr

.maxstack

add.ovf

ble.un

call

.method

add.ovf.un

ble.un.s

calli

callmostderived

conv.ovf.i2.un

decimal

finally

callvirt

conv.ovf.i4

default

fixed

carray

conv.ovf.i4.un

default

float

castclass

conv.ovf.i8

demand

float32

catch

conv.ovf.i8.un

deny

float64

cdecl

conv.ovf.u

div

forwardref

ceq

conv.ovf.u.un

div.un

fromunmanaged

cf

conv.ovf.u1

dup

handler

cgt

conv.ovf.u1.un

endfault

hidebysig

cgt.un

conv.ovf.u2

endfilter

hresult

char

conv.ovf.u2.un

endfinally

idispatch

cil

conv.ovf.u4

endmac

il

ckfinite

conv.ovf.u4.un

enum

illegal

class

conv.ovf.u8

error

implements

clsid

conv.ovf.u8.un

explicit

implicitcom

clt

conv.r.un

extends

implicitres

clt.un

conv.r4

extern

import

const

conv.r8

false

in

conv.i

conv.u

famandassem

inheritcheck

conv.i1

conv.u1

family

init

conv.i2

conv.u2

famorassem

initblk

conv.i4

conv.u4

fastcall

initobj

conv.i8

conv.u8

fastcall

initonly

conv.ovf.i

cpblk

fault

instance

conv.ovf.i.un

cpobj

field

int

conv.ovf.i1

currency

filetime

int16

conv.ovf.i1.un

custom

filter

int32

conv.ovf.i2

date

final

int64

int8

ldc.i4.s

ldind.u1

lpvoid

interface

ldc.i8

ldind.u2

lpwstr

internalcall

ldc.r4

ldind.u4

managed

isinst

ldc.r8

ldind.u8

marshal

iunknown

ldelem.i

ldlen

method

jmp

ldelem.i1

ldloc

mkrefany

lasterr

ldelem.i2

ldloc.0

modopt

lcid

ldelem.i4

ldloc.1

modreq

ldarg

ldelem.i8

ldloc.2

mul

ldarg.0

ldelem.r4

ldloc.3

mul.ovf

ldarg.1

ldelem.r8

ldloc.s

mul.ovf.un

ldarg.2

ldelem.ref

ldloca

native

ldarg.3

ldelem.u1

ldloca.s

neg

ldarg.s

ldelem.u2

ldnull

nested

ldarga

ldelem.u4

ldobj

newarr

ldarga.s

ldelem.u8

ldsfld

newobj

ldc.i4

ldelema

ldsflda

newslot

ldc.i4.0

ldfld

ldstr

noappdomain

ldc.i4.1

ldflda

ldtoken

noinlining

ldc.i4.2

ldftn

ldvirtftn

nomachine

ldc.i4.3

ldind.i

leave

nomangle

ldc.i4.4

ldind.i1

leave.s

nometadata

ldc.i4.5

ldind.i2

linkcheck

noncasdemand

ldc.i4.6

ldind.i4

literal

noncasinheritance

ldc.i4.7

ldind.i8

localloc

noncaslinkdemand

ldc.i4.8

ldind.r4

lpstr

nop

ldc.i4.M1

ldind.r8

lpstruct

noprocess

ldc.i4.m1

ldind.ref

lptstr

not

not_in_gc_heap

privatescope

sizeof

stloc.1

notremotable

protected

special

stloc.2

notserialized

public

specialname

stloc.3

null

readonly

starg

stloc.s

nullref

record

starg.s

stobj

object

refany

static

storage

objectref

refanytype

stdcall

stored_object

opt

refanyval

stdcall

stream

optil

rem

stelem.i

streamed_object

or

rem.un

stelem.i1

string

out

reqmin

stelem.i2

struct

permitonly

reqopt

stelem.i4

stsfld

pinned

reqrefuse

stelem.i8

sub

pinvokeimpl

reqsecobj

stelem.r4

sub.ovf

pop

request

stelem.r8

sub.ovf.un

prefix1

ret

stelem.ref

switch

prefix2

rethrow

stfld

synchronized

prefix3

retval

stind.i

syschar

prefix4

rtspecialname

stind.i1

sysstring

prefix5

runtime

stind.i2

tail.

prefix6

safearray

stind.i4

tbstr

prefix7

sealed

stind.i8

thiscall

prefixref

sequential

stind.r4

thiscall

prejitdeny

serializable

stind.r8

throw

prejitgrant

shl

stind.ref

tls

preservesig

shr

stloc

to

private

shr.un

stloc.0

true

typedref

unsigned

variant

winapi

unaligned.

unused

vector

with

unbox

userdefined

virtual

wrapper

unicode

value

void

xor

unmanaged

valuetype

volatile.

unmanagedexp

vararg

wchar

 

C.2 CIL Opcode Descriptions

This section contains text which is intended for use with the C or C++ preprocessor. By appropriately defining the macros OPDEF and OPALIAS before including this text, it is possible to use this to produce tables or code for handling CIL instructions.

ANNOTATION

Both the previous section and this one were derived from the public headers of the Microsoft implementation of ilasm. Section C.2 is the only public description of this file. The information in C.2 and the contents of that file are used throughout the Microsoft implementations to describe almost all the information on the operation of the IL instructions, which are encoded using these macros.

Because it is very difficult to add new opcode formats, it is not expected over time that many new opcode formats will be created. So if you want to design extensions to the VES, it would be best to ensure that your opcodes have one of these encodings, and that what it pops off of and pushes onto the stack follow these guidelines. Thus, in designing new machine instructions, Microsoft tries to keep within this set, extending it as little as possible. Similarly, it uses this information to handle control flow issues.

This information can be used for building other tools. Microsoft uses it to build one of the verifiers.

Jim Miller


The OPDEF macro is passed ten arguments, in the following order:

  1. A symbolic name for the opcode, beginning with "CEE_".

  2. A string that constitutes the name of the opcode and corresponds to the names given in Partition III.

  3. Data removed from the stack to compute this operations result. The possible values here are the following:

    1. Pop0 no inputs.

    2. Pop1 one value type specified by data flow.

    3. Pop1+Pop1 two input values, types specified by data flow.

    4. PopI one machine-sized integer.

    5. PopI+Pop1 top of stack is described by data flow; next item is a native pointer.

    6. PopI+PopI top two items on stack are integers (size may vary by instruction).

    7. PopI+PopI+PopI top three items on stack are machine-sized integers.

    8. PopI8+Pop8 top of stack is an 8-byte integer; next is a native pointer.

    9. PopI+PopR4 top of stack is a 4-byte floating point number; next is a native pointer.

    10. PopI+PopR8 top of stack is an 8-byte floating point number; next is a native pointer.

    11. PopRef top of stack is an object reference.

    12. PopRef+PopI top of stack is an integer (size may vary by instruction); next is an object reference.

    13. PopRef+PopI+PopI top of stack has two integers (size may vary by instruction); next is an object reference.

    14. PopRef+PopI+PopI8 top of stack is an 8-byte integer, then a native-sized integer, then an object reference.

    15. PopRef+PopI+PopR4 top of stack is a 4-byte floating point number, then a native-sized integer, then an object reference.

    16. PopRef+PopI+PopR8 Top of stack is an 8-byte floating point number, then a native-sized integer, then an object reference.

    17. VarPop variable number of items used; see Partition III for details.

  4. Amount and type of data pushed as a result of the instruction. The possible values here are the following:

    1. Push0 no output value.

    2. Push1 one output value, type defined by data flow.

    3. Push1+Push1 two output values, type defined by data flow.

    4. PushI push one native integer or pointer.

    5. PushI8 push one 8-byte integer.

    6. PushR4 push one 4-byte floating point number.

    7. PushR8 push one 8-byte floating point number.

    8. PushRef push one object reference.

    9. VarPush variable number of items pushed; see Partition III for details.

  5. Type of in-line argument to instruction. The in-line argument is stored with least significant byte first ("little-endian"). The possible values here are the following:

    1. InlineBrTarget branch target, represented as a 4-byte signed integer from the beginning of the instruction following the current instruction.

    2. InlineField metadata token (4 bytes) representing a FieldRef (i.e., a MemberRef to a field) or FieldDef.

    3. InlineI 4-byte integer.

    4. InlineI8 8-byte integer.

    5. InlineMethod metadata token (4 bytes) representing a MethodRef (i.e., a MemberRef to a method) or MethodDef.

    6. InlineNone no in-line argument.

    7. InlineR 8-byte floating point number.

    8. InlineSig metadata token (4 bytes) representing a stand-alone signature.

    9. InlineString metadata token (4 bytes) representing a UserString.

    10. InlineSwitch special for the switch instructions; see Partition III [section 3.66] for details.

    11. InlineTok arbitrary metadata token (4 bytes), used for ldtoken instruction; see Partition III [section 4.16] for details.

    12. InlineType metadata token (4 bytes) representing a TypeDef, TypeRef, or TypeSpec.

    13. InlineVar 2-byte integer representing an argument or local variable.

    14. ShortInlineBrTarget short branch target, represented as 1 signed byte from the beginning of the instruction following the current instruction.

    15. ShortInlineI 1-byte integer, signed or unsigned depending on instruction.

    16. ShortInlineR 4-byte floating point number.

    17. ShortInlineVar 1-byte integer representing an argument or local variable.

  6. Type of opcode. The current classification is of no current value, but is retained for historical reasons.

  7. Number of bytes for the opcode. Currently 1 or 2; can be 4 in future.

  8. First byte of 2-byte encoding, or 0xFF if single-byte instruction.

  9. 1-byte encoding, or second byte of 2-byte encoding.

  10. Control flow implications of instruction. The possible values here are the following:

    1. BRANCH unconditional branch

    2. CALL method call

    3. COND_BRANCH conditional branch

    4. META unused operation or prefix code

    5. NEXT control flow unaltered ("fall through")

    6. RETURN return from method

    7. THROW throw or rethrow an exception

The OPALIAS macro takes three arguments:

  1. A symbolic name for a "new instruction" which is simply an alias (renaming for the assembler) of an existing instruction.

  2. A string name for the "new instruction."

  3. The symbolic name for an instruction introduced using the OPDEF macro. The "new instruction" is really just an alternative name for this instruction.

ANNOTATION

Implementation-Specific (Microsoft): This file is available as include\opcode.def in the Microsoft .NET SDK.


 

#ifndef __OPCODE_DEF_ #define __OPCODE_DEF_ #define MOOT 0x00 // Marks unused second byte when encoding single #define STP1 0xFE // Prefix code 1 for Standard Map #define REFPRE 0xFF // Prefix for Reference Code Encoding #define RESERVED_PREFIX_START 0xF7 #endif // If the first byte of the standard encoding is 0xFF, then // the second byte can be used as 1-byte encoding. Otherwise l b b // the encoding is 2 bytes. e y y // n t t // g e e // (unused) t // Canonical Name String Name Stack Behaviour Operand Params Opcode Kind h 1 2 Control Flow // graphics/ccc.gif ------------------------------------------------------------------------------------------------------------------------------------------------------- graphics/ccc.gifOPDEF(CEE_NOP, "nop", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x00, NEXT) OPDEF(CEE_BREAK, "break", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x01, BREAK) OPDEF(CEE_LDARG_0, "ldarg.0", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x02, NEXT) OPDEF(CEE_LDARG_1, "ldarg.1", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x03, NEXT) OPDEF(CEE_LDARG_2, "ldarg.2", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x04, NEXT) OPDEF(CEE_LDARG_3, "ldarg.3", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x05, NEXT) OPDEF(CEE_LDLOC_0, "ldloc.0", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x06, NEXT) OPDEF(CEE_LDLOC_1, "ldloc.1", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x07, NEXT) OPDEF(CEE_LDLOC_2, "ldloc.2", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x08, NEXT) OPDEF(CEE_LDLOC_3, "ldloc.3", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x09, NEXT) OPDEF(CEE_STLOC_0, "stloc.0", Pop1, Push0, InlineNone, IMacro, 1, 0xFF, 0x0A, NEXT) OPDEF(CEE_STLOC_1, "stloc.1", Pop1, Push0, InlineNone, IMacro, 1, 0xFF, 0x0B, NEXT) OPDEF(CEE_STLOC_2, "stloc.2", Pop1, Push0, InlineNone, IMacro, 1, 0xFF, 0x0C, NEXT) OPDEF(CEE_STLOC_3, "stloc.3", Pop1, Push0, InlineNone, IMacro, 1, 0xFF, 0x0D, NEXT) OPDEF(CEE_LDARG_S, "ldarg.s", Pop0, Push1, ShortInlineVar, IMacro, 1, 0xFF, 0x0E, NEXT) OPDEF(CEE_LDARGA_S, "ldarga.s", Pop0, PushI, ShortInlineVar, IMacro, 1, 0xFF, 0x0F, NEXT) OPDEF(CEE_STARG_S, "starg.s", Pop1, Push0, ShortInlineVar, IMacro, 1, 0xFF, 0x10, NEXT) OPDEF(CEE_LDLOC_S, "ldloc.s", Pop0, Push1, ShortInlineVar, IMacro, 1, 0xFF, 0x11, NEXT) OPDEF(CEE_LDLOCA_S, "ldloca.s", Pop0, PushI, ShortInlineVar, IMacro, 1, 0xFF, 0x12, NEXT) OPDEF(CEE_STLOC_S, "stloc.s", Pop1, Push0, ShortInlineVar, IMacro, 1, 0xFF, 0x13, NEXT) OPDEF(CEE_LDNULL, "ldnull", Pop0, PushRef, InlineNone, IPrimitive, 1, 0xFF, 0x14, NEXT) OPDEF(CEE_LDC_I4_M1, "ldc.i4.m1", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x15, NEXT) OPDEF(CEE_LDC_I4_0, "ldc.i4.0", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x16, NEXT) OPDEF(CEE_LDC_I4_1, "ldc.i4.1", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x17, NEXT) OPDEF(CEE_LDC_I4_2, "ldc.i4.2", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x18, NEXT) OPDEF(CEE_LDC_I4_3, "ldc.i4.3", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x19, NEXT) OPDEF(CEE_LDC_I4_4, "ldc.i4.4", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x1A, NEXT) OPDEF(CEE_LDC_I4_5, "ldc.i4.5", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x1B, NEXT) OPDEF(CEE_LDC_I4_6, "ldc.i4.6", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x1C, NEXT) OPDEF(CEE_LDC_I4_7, "ldc.i4.7", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x1D, NEXT) OPDEF(CEE_LDC_I4_8, "ldc.i4.8", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x1E, NEXT) OPDEF(CEE_LDC_I4_S, "ldc.i4.s", Pop0, PushI, ShortInlineI, IMacro, 1, 0xFF, 0x1F, NEXT) OPDEF(CEE_LDC_I4, "ldc.i4", Pop0, PushI, InlineI, IPrimitive, 1, 0xFF, 0x20, NEXT) OPDEF(CEE_LDC_I8, "ldc.i8", Pop0, PushI8, InlineI8, IPrimitive, 1, 0xFF, 0x21, NEXT) OPDEF(CEE_LDC_R4, "ldc.r4", Pop0, PushR4, ShortInlineR, IPrimitive, 1, 0xFF, 0x22, NEXT) OPDEF(CEE_LDC_R8, "ldc.r8", Pop0, PushR8, InlineR, IPrimitive, 1, 0xFF, 0x23, NEXT) OPDEF(CEE_UNUSED49, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x24, NEXT) OPDEF(CEE_DUP, "dup", Pop1, Push1+Push1, InlineNone, IPrimitive, 1, 0xFF, 0x25, NEXT) OPDEF(CEE_POP, "pop", Pop1, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x26, NEXT) OPDEF(CEE_JMP, "jmp", Pop0, Push0, InlineMethod, IPrimitive, 1, 0xFF, 0x27, CALL) OPDEF(CEE_CALL, "call", VarPop, VarPush, InlineMethod, IPrimitive, 1, 0xFF, 0x28, CALL) OPDEF(CEE_CALLI, "calli", VarPop, VarPush, InlineSig, IPrimitive, 1, 0xFF, 0x29, CALL) OPDEF(CEE_RET, "ret", VarPop, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x2A, RETURN) OPDEF(CEE_BR_S, "br.s", Pop0, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x2B, BRANCH) OPDEF(CEE_BRFALSE_S, "brfalse.s", PopI, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x2C, COND_BRANCH) OPDEF(CEE_BRTRUE_S, "brtrue.s", PopI, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x2D, COND_BRANCH) OPDEF(CEE_BEQ_S, "beq.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x2E, COND_BRANCH) OPDEF(CEE_BGE_S, "bge.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x2F, COND_BRANCH) OPDEF(CEE_BGT_S, "bgt.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x30, COND_BRANCH) OPDEF(CEE_BLE_S, "ble.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x31, COND_BRANCH) OPDEF(CEE_BLT_S, "blt.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x32, COND_BRANCH) OPDEF(CEE_BNE_UN_S, "bne.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x33, COND_BRANCH) OPDEF(CEE_BGE_UN_S, "bge.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x34, COND_BRANCH) OPDEF(CEE_BGT_UN_S, "bgt.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x35, COND_BRANCH) OPDEF(CEE_BLE_UN_S, "ble.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x36, COND_BRANCH) OPDEF(CEE_BLT_UN_S, "blt.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x37, COND_BRANCH) OPDEF(CEE_BR, "br", Pop0, Push0, InlineBrTarget, IPrimitive, 1, 0xFF, 0x38, BRANCH) OPDEF(CEE_BRFALSE, "brfalse", PopI, Push0, InlineBrTarget, IPrimitive, 1, 0xFF, 0x39, COND_BRANCH) OPDEF(CEE_BRTRUE, "brtrue", PopI, Push0, InlineBrTarget, IPrimitive, 1, 0xFF, 0x3A, COND_BRANCH) OPDEF(CEE_BEQ, "beq", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x3B, COND_BRANCH) OPDEF(CEE_BGE, "bge", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x3C, COND_BRANCH) OPDEF(CEE_BGT, "bgt", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x3D, COND_BRANCH) OPDEF(CEE_BLE, "ble", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x3E, COND_BRANCH) OPDEF(CEE_BLT, "blt", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x3F, COND_BRANCH) OPDEF(CEE_BNE_UN, "bne.un", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x40, COND_BRANCH) OPDEF(CEE_BGE_UN, "bge.un", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x41, COND_BRANCH) OPDEF(CEE_BGT_UN, "bgt.un", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x42, COND_BRANCH) OPDEF(CEE_BLE_UN, "ble.un", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x43, COND_BRANCH) OPDEF(CEE_BLT_UN, "blt.un", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x44, COND_BRANCH) OPDEF(CEE_SWITCH, "switch", PopI, Push0, InlineSwitch, IPrimitive, 1, 0xFF, 0x45, COND_BRANCH) OPDEF(CEE_LDIND_I1, "ldind.i1", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x46, NEXT) OPDEF(CEE_LDIND_U1, "ldind.u1", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x47, NEXT) OPDEF(CEE_LDIND_I2, "ldind.i2", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x48, NEXT) OPDEF(CEE_LDIND_U2, "ldind.u2", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x49, NEXT) OPDEF(CEE_LDIND_I4, "ldind.i4", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x4A, NEXT) OPDEF(CEE_LDIND_U4, "ldind.u4", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x4B, NEXT) OPDEF(CEE_LDIND_I8, "ldind.i8", PopI, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0x4C, NEXT) OPDEF(CEE_LDIND_I, "ldind.i", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x4D, NEXT) OPDEF(CEE_LDIND_R4, "ldind.r4", PopI, PushR4, InlineNone, IPrimitive, 1, 0xFF, 0x4E, NEXT) OPDEF(CEE_LDIND_R8, "ldind.r8", PopI, PushR8, InlineNone, IPrimitive, 1, 0xFF, 0x4F, NEXT) OPDEF(CEE_LDIND_REF, "ldind.ref", PopI, PushRef, InlineNone, IPrimitive, 1, 0xFF, 0x50, NEXT) OPDEF(CEE_STIND_REF, "stind.ref", PopI+PopI, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x51, NEXT) OPDEF(CEE_STIND_I1, "stind.i1", PopI+PopI, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x52, NEXT) OPDEF(CEE_STIND_I2, "stind.i2", PopI+PopI, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x53, NEXT) OPDEF(CEE_STIND_I4, "stind.i4", PopI+PopI, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x54, NEXT) OPDEF(CEE_STIND_I8, "stind.i8", PopI+PopI8, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x55, NEXT) OPDEF(CEE_STIND_R4, "stind.r4", PopI+PopR4, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x56, NEXT) OPDEF(CEE_STIND_R8, "stind.r8", PopI+PopR8, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x57, NEXT) OPDEF(CEE_ADD, "add", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x58, NEXT) OPDEF(CEE_SUB, "sub", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x59, NEXT) OPDEF(CEE_MUL, "mul", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5A, NEXT) OPDEF(CEE_DIV, "div", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5B, NEXT) OPDEF(CEE_DIV_UN, "div.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5C, NEXT) OPDEF(CEE_REM, "rem", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5D, NEXT) OPDEF(CEE_REM_UN, "rem.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5E, NEXT) OPDEF(CEE_AND, "and", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5F, NEXT) OPDEF(CEE_OR, "or", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x60, NEXT) OPDEF(CEE_XOR, "xor", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x61, NEXT) OPDEF(CEE_SHL, "shl", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x62, NEXT) OPDEF(CEE_SHR, "shr", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x63, NEXT) OPDEF(CEE_SHR_UN, "shr.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x64, NEXT) OPDEF(CEE_NEG, "neg", Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x65, NEXT) OPDEF(CEE_NOT, "not", Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x66, NEXT) OPDEF(CEE_CONV_I1, "conv.i1", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x67, NEXT) OPDEF(CEE_CONV_I2, "conv.i2", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x68, NEXT) OPDEF(CEE_CONV_I4, "conv.i4", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x69, NEXT) OPDEF(CEE_CONV_I8, "conv.i8", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0x6A, NEXT) OPDEF(CEE_CONV_R4, "conv.r4", Pop1, PushR4, InlineNone, IPrimitive, 1, 0xFF, 0x6B, NEXT) OPDEF(CEE_CONV_R8, "conv.r8", Pop1, PushR8, InlineNone, IPrimitive, 1, 0xFF, 0x6C, NEXT) OPDEF(CEE_CONV_U4, "conv.u4", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x6D, NEXT) OPDEF(CEE_CONV_U8, "conv.u8", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0x6E, NEXT) OPDEF(CEE_CALLVIRT, "callvirt", VarPop, VarPush, InlineMethod, IObjModel, 1, 0xFF, 0x6F, CALL) OPDEF(CEE_CPOBJ, "cpobj", PopI+PopI, Push0, InlineType, IObjModel, 1, 0xFF, 0x70, NEXT) OPDEF(CEE_LDOBJ, "ldobj", PopI, Push1, InlineType, IObjModel, 1, 0xFF, 0x71, NEXT) OPDEF(CEE_LDSTR, "ldstr", Pop0, PushRef, InlineString, IObjModel, 1, 0xFF, 0x72, NEXT) OPDEF(CEE_NEWOBJ, "newobj", VarPop, PushRef, InlineMethod, IObjModel, 1, 0xFF, 0x73, CALL) OPDEF(CEE_CASTCLASS, "castclass", PopRef, PushRef, InlineType, IObjModel, 1, 0xFF, 0x74, NEXT) OPDEF(CEE_ISINST, "isinst", PopRef, PushI, InlineType, IObjModel, 1, 0xFF, 0x75, NEXT) OPDEF(CEE_CONV_R_UN, "conv.r.un", Pop1, PushR8, InlineNone, IPrimitive, 1, 0xFF, 0x76, NEXT) OPDEF(CEE_UNUSED58, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x77, NEXT) OPDEF(CEE_UNUSED1, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x78, NEXT) OPDEF(CEE_UNBOX, "unbox", PopRef, PushI, InlineType, IPrimitive, 1, 0xFF, 0x79, NEXT) OPDEF(CEE_THROW, "throw", PopRef, Push0, InlineNone, IObjModel, 1, 0xFF, 0x7A, THROW) OPDEF(CEE_LDFLD, "ldfld", PopRef, Push1, InlineField, IObjModel, 1, 0xFF, 0x7B, NEXT) OPDEF(CEE_LDFLDA, "ldflda", PopRef, PushI, InlineField, IObjModel, 1, 0xFF, 0x7C, NEXT) OPDEF(CEE_STFLD, "stfld", PopRef+Pop1, Push0, InlineField, IObjModel, 1, 0xFF, 0x7D, NEXT) OPDEF(CEE_LDSFLD, "ldsfld", Pop0, Push1, InlineField, IObjModel, 1, 0xFF, 0x7E, NEXT) OPDEF(CEE_LDSFLDA, "ldsflda", Pop0, PushI, InlineField, IObjModel, 1, 0xFF, 0x7F, NEXT) OPDEF(CEE_STSFLD, "stsfld", Pop1, Push0, InlineField, IObjModel, 1, 0xFF, 0x80, NEXT) OPDEF(CEE_STOBJ, "stobj", PopI+Pop1, Push0, InlineType, IPrimitive, 1, 0xFF, 0x81, NEXT) OPDEF(CEE_CONV_OVF_I1_UN, "conv.ovf.i1.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x82, NEXT) OPDEF(CEE_CONV_OVF_I2_UN, "conv.ovf.i2.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x83, NEXT) OPDEF(CEE_CONV_OVF_I4_UN, "conv.ovf.i4.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x84, NEXT) OPDEF(CEE_CONV_OVF_I8_UN, "conv.ovf.i8.un", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0x85, NEXT) OPDEF(CEE_CONV_OVF_U1_UN, "conv.ovf.u1.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x86, NEXT) OPDEF(CEE_CONV_OVF_U2_UN, "conv.ovf.u2.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x87, NEXT) OPDEF(CEE_CONV_OVF_U4_UN, "conv.ovf.u4.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x88, NEXT) OPDEF(CEE_CONV_OVF_U8_UN, "conv.ovf.u8.un", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0x89, NEXT) OPDEF(CEE_CONV_OVF_I_UN, "conv.ovf.i.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x8A, NEXT) OPDEF(CEE_CONV_OVF_U_UN, "conv.ovf.u.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x8B, NEXT) OPDEF(CEE_BOX, "box", Pop1, PushRef, InlineType, IPrimitive, 1, 0xFF, 0x8C, NEXT) OPDEF(CEE_NEWARR, "newarr", PopI, PushRef, InlineType, IObjModel, 1, 0xFF, 0x8D, NEXT) OPDEF(CEE_LDLEN, "ldlen", PopRef, PushI, InlineNone, IObjModel, 1, 0xFF, 0x8E, NEXT) OPDEF(CEE_LDELEMA, "ldelema", PopRef+PopI, PushI, InlineType, IObjModel, 1, 0xFF, 0x8F, NEXT) OPDEF(CEE_LDELEM_I1, "ldelem.i1", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x90, NEXT) OPDEF(CEE_LDELEM_U1, "ldelem.u1", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x91, NEXT) OPDEF(CEE_LDELEM_I2, "ldelem.i2", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x92, NEXT) OPDEF(CEE_LDELEM_U2, "ldelem.u2", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x93, NEXT) OPDEF(CEE_LDELEM_I4, "ldelem.i4", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x94, NEXT) OPDEF(CEE_LDELEM_U4, "ldelem.u4", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x95, NEXT) OPDEF(CEE_LDELEM_I8, "ldelem.i8", PopRef+PopI, PushI8, InlineNone, IObjModel, 1, 0xFF, 0x96, NEXT) OPDEF(CEE_LDELEM_I, "ldelem.i", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x97, NEXT) OPDEF(CEE_LDELEM_R4, "ldelem.r4", PopRef+PopI, PushR4, InlineNone, IObjModel, 1, 0xFF, 0x98, NEXT) OPDEF(CEE_LDELEM_R8, "ldelem.r8", PopRef+PopI, PushR8, InlineNone, IObjModel, 1, 0xFF, 0x99, NEXT) OPDEF(CEE_LDELEM_REF, "ldelem.ref", PopRef+PopI, PushRef, InlineNone, IObjModel, 1, 0xFF, 0x9A, NEXT) OPDEF(CEE_STELEM_I, "stelem.i", PopRef+PopI+PopI, Push0, InlineNone, IObjModel, 1, 0xFF, 0x9B, NEXT) OPDEF(CEE_STELEM_I1, "stelem.i1", PopRef+PopI+PopI, Push0, InlineNone, IObjModel, 1, 0xFF, 0x9C, NEXT) OPDEF(CEE_STELEM_I2, "stelem.i2", PopRef+PopI+PopI, Push0, InlineNone, IObjModel, 1, 0xFF, 0x9D, NEXT) OPDEF(CEE_STELEM_I4, "stelem.i4", PopRef+PopI+PopI, Push0, InlineNone, IObjModel, 1, 0xFF, 0x9E, NEXT) OPDEF(CEE_STELEM_I8, "stelem.i8", PopRef+PopI+PopI8, Push0, InlineNone, IObjModel, 1, 0xFF, 0x9F, NEXT) OPDEF(CEE_STELEM_R4, "stelem.r4", PopRef+PopI+PopR4, Push0, InlineNone, IObjModel, 1, 0xFF, 0xA0, NEXT) OPDEF(CEE_STELEM_R8, "stelem.r8", PopRef+PopI+PopR8, Push0, InlineNone, IObjModel, 1, 0xFF, 0xA1, NEXT) OPDEF(CEE_STELEM_REF, "stelem.ref", PopRef+PopI+PopRef, Push0, InlineNone, IObjModel, 1, 0xFF, 0xA2, NEXT) OPDEF(CEE_UNUSED2, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA3, NEXT) OPDEF(CEE_UNUSED3, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA4, NEXT) OPDEF(CEE_UNUSED4, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA5, NEXT) OPDEF(CEE_UNUSED5, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA6, NEXT) OPDEF(CEE_UNUSED6, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA7, NEXT) OPDEF(CEE_UNUSED7, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA8, NEXT) OPDEF(CEE_UNUSED8, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA9, NEXT) OPDEF(CEE_UNUSED9, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAA, NEXT) OPDEF(CEE_UNUSED10, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAB, NEXT) OPDEF(CEE_UNUSED11, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAC, NEXT) OPDEF(CEE_UNUSED12, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAD, NEXT) OPDEF(CEE_UNUSED13, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAE, NEXT) OPDEF(CEE_UNUSED14, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAF, NEXT) OPDEF(CEE_UNUSED15, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xB0, NEXT) OPDEF(CEE_UNUSED16, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xB1, NEXT) OPDEF(CEE_UNUSED17, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xB2, NEXT) OPDEF(CEE_CONV_OVF_I1, "conv.ovf.i1", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB3, NEXT) OPDEF(CEE_CONV_OVF_U1, "conv.ovf.u1", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB4, NEXT) OPDEF(CEE_CONV_OVF_I2, "conv.ovf.i2", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB5, NEXT) OPDEF(CEE_CONV_OVF_U2, "conv.ovf.u2", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB6, NEXT) OPDEF(CEE_CONV_OVF_I4, "conv.ovf.i4", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB7, NEXT) OPDEF(CEE_CONV_OVF_U4, "conv.ovf.u4", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB8, NEXT) OPDEF(CEE_CONV_OVF_I8, "conv.ovf.i8", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0xB9, NEXT) OPDEF(CEE_CONV_OVF_U8, "conv.ovf.u8", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0xBA, NEXT) OPDEF(CEE_UNUSED50, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xBB, NEXT) OPDEF(CEE_UNUSED18, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xBC, NEXT) OPDEF(CEE_UNUSED19, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xBD, NEXT) OPDEF(CEE_UNUSED20, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xBE, NEXT) OPDEF(CEE_UNUSED21, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xBF, NEXT) OPDEF(CEE_UNUSED22, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC0, NEXT) OPDEF(CEE_UNUSED23, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC1, NEXT) OPDEF(CEE_REFANYVAL, "refanyval", Pop1, PushI, InlineType, IPrimitive, 1, 0xFF, 0xC2, NEXT) OPDEF(CEE_CKFINITE, "ckfinite", Pop1, PushR8, InlineNone, IPrimitive, 1, 0xFF, 0xC3, NEXT) OPDEF(CEE_UNUSED24, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC4, NEXT) OPDEF(CEE_UNUSED25, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC5, NEXT) OPDEF(CEE_MKREFANY, "mkrefany", PopI, Push1, InlineType, IPrimitive, 1, 0xFF, 0xC6, NEXT) OPDEF(CEE_UNUSED59, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC7, NEXT) OPDEF(CEE_UNUSED60, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC8, NEXT) OPDEF(CEE_UNUSED61, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC9, NEXT) OPDEF(CEE_UNUSED62, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCA, NEXT) OPDEF(CEE_UNUSED63, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCB, NEXT) OPDEF(CEE_UNUSED64, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCC, NEXT) OPDEF(CEE_UNUSED65, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCD, NEXT) OPDEF(CEE_UNUSED66, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCE, NEXT) OPDEF(CEE_UNUSED67, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCF, NEXT) OPDEF(CEE_LDTOKEN, "ldtoken", Pop0, PushI, InlineTok, IPrimitive, 1, 0xFF, 0xD0, NEXT) OPDEF(CEE_CONV_U2, "conv.u2", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xD1, NEXT) OPDEF(CEE_CONV_U1, "conv.u1", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xD2, NEXT) OPDEF(CEE_CONV_I, "conv.i", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xD3, NEXT) OPDEF(CEE_CONV_OVF_I, "conv.ovf.i", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xD4, NEXT) OPDEF(CEE_CONV_OVF_U, "conv.ovf.u", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xD5, NEXT) OPDEF(CEE_ADD_OVF, "add.ovf", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xD6, NEXT) OPDEF(CEE_ADD_OVF_UN, "add.ovf.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xD7, NEXT) OPDEF(CEE_MUL_OVF, "mul.ovf", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xD8, NEXT) OPDEF(CEE_MUL_OVF_UN, "mul.ovf.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xD9, NEXT) OPDEF(CEE_SUB_OVF, "sub.ovf", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xDA, NEXT) OPDEF(CEE_SUB_OVF_UN, "sub.ovf.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xDB, NEXT) OPDEF(CEE_ENDFINALLY, "endfinally", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xDC, RETURN) OPDEF(CEE_LEAVE, "leave", Pop0, Push0, InlineBrTarget, IPrimitive, 1, 0xFF, 0xDD, BRANCH) OPDEF(CEE_LEAVE_S, "leave.s", Pop0, Push0, ShortInlineBrTarget,IPrimitive, 1, 0xFF, 0xDE, BRANCH) OPDEF(CEE_STIND_I, "stind.i", PopI+PopI, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xDF, NEXT) OPDEF(CEE_CONV_U, "conv.u", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xE0, NEXT) OPDEF(CEE_UNUSED26, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE1, NEXT) OPDEF(CEE_UNUSED27, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE2, NEXT) OPDEF(CEE_UNUSED28, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE3, NEXT) OPDEF(CEE_UNUSED29, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE4, NEXT) OPDEF(CEE_UNUSED30, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE5, NEXT) OPDEF(CEE_UNUSED31, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE6, NEXT) OPDEF(CEE_UNUSED32, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE7, NEXT) OPDEF(CEE_UNUSED33, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE8, NEXT) OPDEF(CEE_UNUSED34, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE9, NEXT) OPDEF(CEE_UNUSED35, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xEA, NEXT) OPDEF(CEE_UNUSED36, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xEB, NEXT) OPDEF(CEE_UNUSED37, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xEC, NEXT) OPDEF(CEE_UNUSED38, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xED, NEXT) OPDEF(CEE_UNUSED39, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xEE, NEXT) OPDEF(CEE_UNUSED40, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xEF, NEXT) OPDEF(CEE_UNUSED41, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF0, NEXT) OPDEF(CEE_UNUSED42, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF1, NEXT) OPDEF(CEE_UNUSED43, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF2, NEXT) OPDEF(CEE_UNUSED44, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF3, NEXT) OPDEF(CEE_UNUSED45, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF4, NEXT) OPDEF(CEE_UNUSED46, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF5, NEXT) OPDEF(CEE_UNUSED47, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF6, NEXT) OPDEF(CEE_UNUSED48, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF7, NEXT) OPDEF(CEE_PREFIX7, "prefix7", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xF8, META) OPDEF(CEE_PREFIX6, "prefix6", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xF9, META) OPDEF(CEE_PREFIX5, "prefix5", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFA, META) OPDEF(CEE_PREFIX4, "prefix4", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFB, META) OPDEF(CEE_PREFIX3, "prefix3", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFC, META) OPDEF(CEE_PREFIX2, "prefix2", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFD, META) OPDEF(CEE_PREFIX1, "prefix1", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFE, META) OPDEF(CEE_PREFIXREF, "prefixref", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFF, META) OPDEF(CEE_ARGLIST, "arglist", Pop0, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x00, NEXT) OPDEF(CEE_CEQ, "ceq", Pop1+Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x01, NEXT) OPDEF(CEE_CGT, "cgt", Pop1+Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x02, NEXT) OPDEF(CEE_CGT_UN, "cgt.un", Pop1+Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x03, NEXT) OPDEF(CEE_CLT, "clt", Pop1+Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x04, NEXT) OPDEF(CEE_CLT_UN, "clt.un", Pop1+Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x05, NEXT) OPDEF(CEE_LDFTN, "ldftn", Pop0, PushI, InlineMethod, IPrimitive, 2, 0xFE, 0x06, NEXT) OPDEF(CEE_LDVIRTFTN, "ldvirtftn", PopRef, PushI, InlineMethod, IPrimitive, 2, 0xFE, 0x07, NEXT) OPDEF(CEE_UNUSED56, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x08, NEXT) OPDEF(CEE_LDARG, "ldarg", Pop0, Push1, InlineVar, IPrimitive, 2, 0xFE, 0x09, NEXT) OPDEF(CEE_LDARGA, "ldarga", Pop0, PushI, InlineVar, IPrimitive, 2, 0xFE, 0x0A, NEXT) OPDEF(CEE_STARG, "starg", Pop1, Push0, InlineVar, IPrimitive, 2, 0xFE, 0x0B, NEXT) OPDEF(CEE_LDLOC, "ldloc", Pop0, Push1, InlineVar, IPrimitive, 2, 0xFE, 0x0C, NEXT) OPDEF(CEE_LDLOCA, "ldloca", Pop0, PushI, InlineVar, IPrimitive, 2, 0xFE, 0x0D, NEXT) OPDEF(CEE_STLOC, "stloc", Pop1, Push0, InlineVar, IPrimitive, 2, 0xFE, 0x0E, NEXT) OPDEF(CEE_LOCALLOC, "localloc", PopI, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x0F, NEXT) OPDEF(CEE_UNUSED57, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x10, NEXT) OPDEF(CEE_ENDFILTER, "endfilter", PopI, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x11, RETURN) OPDEF(CEE_UNALIGNED, "unaligned.", Pop0, Push0, ShortInlineI, IPrefix, 2, 0xFE, 0x12, META) OPDEF(CEE_VOLATILE, "volatile.", Pop0, Push0, InlineNone, IPrefix, 2, 0xFE, 0x13, META) OPDEF(CEE_TAILCALL, "tail.", Pop0, Push0, InlineNone, IPrefix, 2, 0xFE, 0x14, META) OPDEF(CEE_INITOBJ, "initobj", PopI, Push0, InlineType, IObjModel, 2, 0xFE, 0x15, NEXT) OPDEF(CEE_UNUSED68, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x16, NEXT) OPDEF(CEE_CPBLK, "cpblk", PopI+PopI+PopI, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x17, NEXT) OPDEF(CEE_INITBLK, "initblk", PopI+PopI+PopI, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x18, NEXT) OPDEF(CEE_UNUSED69, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x19, NEXT) OPDEF(CEE_RETHROW, "rethrow", Pop0, Push0, InlineNone, IObjModel, 2, 0xFE, 0x1A, THROW) OPDEF(CEE_UNUSED51, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x1B, NEXT) OPDEF(CEE_SIZEOF, "sizeof", Pop0, PushI, InlineType, IPrimitive, 2, 0xFE, 0x1C, NEXT) OPDEF(CEE_REFANYTYPE, "refanytype", Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x1D, NEXT) OPDEF(CEE_UNUSED52, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x1E, NEXT) OPDEF(CEE_UNUSED53, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x1F, NEXT) OPDEF(CEE_UNUSED54, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x20, NEXT) OPDEF(CEE_UNUSED55, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x21, NEXT) OPDEF(CEE_UNUSED70, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x22, NEXT) // These are not real opcodes, but they are handy internally in the EE OPDEF(CEE_ILLEGAL, "illegal", Pop0, Push0, InlineNone, IInternal, 0, MOOT, MOOT, META) OPDEF(CEE_MACRO_END, "endmac", Pop0, Push0, InlineNone, IInternal, 0, MOOT, MOOT, META) #ifndef OPALIAS #define _OPALIAS_DEFINED_ #define OPALIAS(canonicalName, stringName, realOpcode) #endif OPALIAS(CEE_BRNULL, "brnull", CEE_BRFALSE) OPALIAS(CEE_BRNULL_S, "brnull.s", CEE_BRFALSE_S) OPALIAS(CEE_BRZERO, "brzero", CEE_BRFALSE) OPALIAS(CEE_BRZERO_S, "brzero.s", CEE_BRFALSE_S) OPALIAS(CEE_BRINST, "brinst", CEE_BRTRUE) OPALIAS(CEE_BRINST_S, "brinst.s", CEE_BRTRUE_S) OPALIAS(CEE_LDIND_U8, "ldind.u8", CEE_LDIND_I8) OPALIAS(CEE_LDELEM_U8, "ldelem.u8", CEE_LDELEM_I8) OPALIAS(CEE_LDC_I4_M1x, "ldc.i4.M1", CEE_LDC_I4_M1) OPALIAS(CEE_ENDFAULT, "endfault", CEE_ENDFINALLY) #ifdef _OPALIAS_DEFINED_ #undef OPALIAS #undef _OPALIAS_DEFINED_ #endif

C.3 Complete Grammar

This grammar provides a number of ease-of-use features not provided in the grammar of Partition II, sections 1 20, as well as supporting some features which are not portable across implementations and hence are not part of this standard. Unlike the grammar of Partition II, this one is designed for ease of programming rather than ease of reading; it can be converted directly into a YACC grammar.

ANNOTATION

Implementation-Specific (Microsoft): This file is available as include\asmparse. grammar in the Microsoft .NET SDK.


ANNOTATION

The normative ilasm syntax in Partition II was largely derived from the syntax part of the productions in this file, which ships as part of Microsoft's shared source implementation of the CLI ("Rotor"). Studying these rules made it straightforward to determine which parts of the metadata were affected by which parts of the grammar. This analysis led directly to much of the information in Partition II.

Jim Miller


 

Lexical tokens ID - C style alphaNumeric identifier (e.g. Hello_There2) QSTRING - C style quoted string (e.g. "hi\n") SQSTRING - C style singlely quoted string(e.g. 'hi') INT32 - C style 32 bit integer (e.g. 235, 03423, 0x34FFF) INT64 - C style 64 bit integer (e.g. -2353453636235234, 0x34FFFFFFFFFF) FLOAT64 - C style floating point number (e.g. -0.2323, 354.3423, 3435.34E-5) INSTR_* - IL instructions of a particular class (see opcode.def). ---------------------------------------------------------------------------------- START : decls ; decls : /* EMPTY */ | decls decl ; decl : classHead '{' classDecls '}' | nameSpaceHead '{' decls '}' | methodHead methodDecls '}' | fieldDecl | dataDecl | vtableDecl | vtfixupDecl | extSourceSpec | fileDecl | assemblyHead '{' assemblyDecls '}' | assemblyRefHead '{' assemblyRefDecls '}' | comtypeHead '{' comtypeDecls '}' | manifestResHead '{' manifestResDecls '}' | moduleHead | secDecl | customAttrDecl | '.subsystem' int32 | '.corflags' int32 | '.file' 'alignment' int32 | '.imagebase' int64 | languageDecl ; compQstring : QSTRING | compQstring '+' QSTRING ; languageDecl : '.language' SQSTRING | '.language' SQSTRING ',' SQSTRING | '.language' SQSTRING ',' SQSTRING ',' SQSTRING ; customAttrDecl : '.custom' customType | '.custom' customType '=' compQstring | customHead bytes ')' | '.custom' '(' ownerType ')' customType | '.custom' '(' ownerType ')' customType '=' compQstring | customHeadWithOwner bytes ')' ; moduleHead : '.module' | '.module' name1 | '.module' 'extern' name1 ; vtfixupDecl : '.vtfixup' '[' int32 ']' vtfixupAttr 'at' id ; vtfixupAttr : /* EMPTY */ | vtfixupAttr 'int32' | vtfixupAttr 'int64' | vtfixupAttr 'fromunmanaged' | vtfixupAttr 'callmostderived' ; vtableDecl : vtableHead bytes ')' ; vtableHead : '.vtable' '=' '(' ; nameSpaceHead : '.namespace' name1 ; classHead : '.class' classAttr id extendsClause implClause ; classAttr : /* EMPTY */ | classAttr 'public' | classAttr 'private' | classAttr 'value' | classAttr 'enum' | classAttr 'interface' | classAttr 'sealed' | classAttr 'abstract' | classAttr 'auto' | classAttr 'sequential' | classAttr 'explicit' | classAttr 'ansi' | classAttr 'unicode' | classAttr 'autochar' | classAttr 'import' | classAttr 'serializable' | classAttr 'nested' 'public' | classAttr 'nested' 'private' | classAttr 'nested' 'family' | classAttr 'nested' 'assembly' | classAttr 'nested' 'famandassem' | classAttr 'nested' 'famorassem' | classAttr 'beforefieldinit' | classAttr 'specialname' | classAttr 'rtspecialname' ; extendsClause : /* EMPTY */ | 'extends' className ; implClause : /* EMPTY */ | 'implements' classNames ; classNames : classNames ',' className | className ; classDecls : /* EMPTY */ | classDecls classDecl ; classDecl : methodHead methodDecls '}' | classHead '{' classDecls '}' | eventHead '{' eventDecls '}' | propHead '{' propDecls '}' | fieldDecl | dataDecl | secDecl | extSourceSpec | customAttrDecl | '.size' int32 | '.pack' int32 | exportHead '{' comtypeDecls '}' | '.override' typeSpec '::' methodName 'with' callConv type typeSpec '::' methodName '(' sigArgs0 ')' | languageDecl ; fieldDecl : '.field' repeatOpt fieldAttr type id atOpt initOpt ; atOpt : /* EMPTY */ | 'at' id ; initOpt : /* EMPTY */ | '=' fieldInit ; repeatOpt : /* EMPTY */ | '[' int32 ']' ; customHead : '.custom' customType '=' '(' ; customHeadWithOwner : '.custom' '(' ownerType ')' customType '=' '(' ; memberRef : methodSpec callConv type typeSpec '::' methodName '(' sigArgs0 ')' | methodSpec callConv type methodName '(' sigArgs0 ')' | 'field' type typeSpec '::' id | 'field' type id ; customType : callConv type typeSpec '::' '.ctor' '(' sigArgs0 ')' | callConv type '.ctor' '(' sigArgs0 ')' ; ownerType : typeSpec | memberRef ; eventHead : '.event' eventAttr typeSpec id | '.event' eventAttr id ; eventAttr : /* EMPTY */ | eventAttr 'rtspecialname' /**/ | eventAttr 'specialname' ; eventDecls : /* EMPTY */ | eventDecls eventDecl ; eventDecl : '.addon' callConv type typeSpec '::' methodName '(' sigArgs0 ')' | '.addon' callConv type methodName '(' sigArgs0 ')' | '.removeon' callConv type typeSpec '::' methodName '(' sigArgs0 ')' | '.removeon' callConv type methodName '(' sigArgs0 ')' | '.fire' callConv type typeSpec '::' methodName '(' sigArgs0 ')' | '.fire' callConv type methodName '(' sigArgs0 ')' | '.other' callConv type typeSpec '::' methodName '(' sigArgs0 ')' | '.other' callConv type methodName '(' sigArgs0 ')' | extSourceSpec | customAttrDecl | languageDecl ; propHead : '.property' propAttr callConv type id '(' sigArgs0 ')' initOpt ; propAttr : /* EMPTY */ | propAttr 'rtspecialname' /**/ | propAttr 'specialname' ; propDecls : /* EMPTY */ | propDecls propDecl ; propDecl : '.set' callConv type typeSpec '::' methodName '(' sigArgs0 ')' | '.set' callConv type methodName '(' sigArgs0 ')' | '.get' callConv type typeSpec '::' methodName '(' sigArgs0 ')' | '.get' callConv type methodName '(' sigArgs0 ')' | '.other' callConv type typeSpec '::' methodName '(' sigArgs0 ')' | '.other' callConv type methodName '(' sigArgs0 ')' | customAttrDecl | extSourceSpec | languageDecl ; methodHeadPart1 : '.method' ; methodHead : methodHeadPart1 methAttr callConv paramAttr type methodName '(' graphics/ccc.gif sigArgs0 ')' implAttr '{' | methodHeadPart1 methAttr callConv paramAttr type 'marshal' '(' graphics/ccc.gif nativeType ')' methodName '(' sigArgs0 ')' implAttr '{' ; methAttr : /* EMPTY */ | methAttr 'static' | methAttr 'public' | methAttr 'private' | methAttr 'family' | methAttr 'final' | methAttr 'specialname' | methAttr 'virtual' | methAttr 'abstract' | methAttr 'assembly' | methAttr 'famandassem' | methAttr 'famorassem' | methAttr 'privatescope' | methAttr 'hidebysig' | methAttr 'newslot' | methAttr 'rtspecialname' /**/ | methAttr 'unmanagedexp' | methAttr 'reqsecobj' | methAttr 'pinvokeimpl' '(' compQstring 'as' compQstring pinvAttr ')' | methAttr 'pinvokeimpl' '(' compQstring pinvAttr ')' | methAttr 'pinvokeimpl' '(' pinvAttr ')' ; pinvAttr : /* EMPTY */ | pinvAttr 'nomangle' | pinvAttr 'ansi' | pinvAttr 'unicode' | pinvAttr 'autochar' | pinvAttr 'lasterr' | pinvAttr 'winapi' | pinvAttr 'cdecl' | pinvAttr 'stdcall' | pinvAttr 'thiscall' | pinvAttr 'fastcall' ; methodName : '.ctor' | '.cctor' | name1 ; paramAttr : /* EMPTY */ | paramAttr '[' 'in' ']' | paramAttr '[' 'out' ']' | paramAttr '[' 'opt' ']' | paramAttr '[' int32 ']' ; fieldAttr : /* EMPTY */ | fieldAttr 'static' | fieldAttr 'public' | fieldAttr 'private' | fieldAttr 'family' | fieldAttr 'initonly' | fieldAttr 'rtspecialname' /**/ | fieldAttr 'specialname' /* commented out because PInvoke for fields is not supported by EE | fieldAttr 'pinvokeimpl' '(' compQstring 'as' compQstring graphics/ccc.gif pinvAttr ')' | fieldAttr 'pinvokeimpl' '(' compQstring pinvAttr ')' | fieldAttr 'pinvokeimpl' '(' pinvAttr ')' */ | fieldAttr 'marshal' '(' nativeType ')' | fieldAttr 'assembly' | fieldAttr 'famandassem' | fieldAttr 'famorassem' | fieldAttr 'privatescope' | fieldAttr 'literal' | fieldAttr 'notserialized' ; implAttr : /* EMPTY */ | implAttr 'native' | implAttr 'cil' | implAttr 'optil' | implAttr 'managed' | implAttr 'unmanaged' | implAttr 'forwardref' | implAttr 'preservesig' | implAttr 'runtime' | implAttr 'internalcall' | implAttr 'synchronized' | implAttr 'noinlining' ; localsHead : '.locals' ; methodDecl : '.emitbyte' int32 | sehBlock | '.maxstack' int32 | localsHead '(' sigArgs0 ')' | localsHead 'init' '(' sigArgs0 ')' | '.entrypoint' | '.zeroinit' | dataDecl | instr | id ':' | secDecl | extSourceSpec | languageDecl | customAttrDecl | '.export' '[' int32 ']' | '.export' '[' int32 ']''as' id | '.vtentry' int32 ':' int32 | '.override' typeSpec '::' methodName | scopeBlock | '.param' '[' int32 ']' initOpt ; scopeBlock : scopeOpen methodDecls '}' ; scopeOpen : '{' ; sehBlock : tryBlock sehClauses ; sehClauses : sehClause sehClauses | sehClause ; tryBlock : tryHead scopeBlock | tryHead id 'to' id | tryHead int32 'to' int32 ; tryHead : '.try' ; sehClause : catchClause handlerBlock | filterClause handlerBlock | finallyClause handlerBlock | faultClause handlerBlock ; filterClause : filterHead scopeBlock | filterHead id | filterHead int32 ; filterHead : 'filter' ; catchClause : 'catch' className ; finallyClause : 'finally' ; faultClause : 'fault' ; handlerBlock : scopeBlock | 'handler' id 'to' id | 'handler' int32 'to' int32 ; methodDecls : /* EMPTY */ | methodDecls methodDecl ; dataDecl : ddHead ddBody ; ddHead : '.data' tls id '=' | '.data' tls ; tls : /* EMPTY */ | 'tls' ; ddBody : '{' ddItemList '}' | ddItem ; ddItemList : ddItem ',' ddItemList | ddItem ; ddItemCount : /* EMPTY */ | '[' int32 ']' ; ddItem : 'char' '*' '(' compQstring ')' | '&' '(' id ')' | bytearrayhead bytes ')' | 'float32' '(' float64 ')' ddItemCount | 'float64' '(' float64 ')' ddItemCount | 'int64' '(' int64 ')' ddItemCount | 'int32' '(' int32 ')' ddItemCount | 'int16' '(' int32 ')' ddItemCount | 'int8' '(' int32 ')' ddItemCount | 'float32' ddItemCount | 'float64' ddItemCount | 'int64' ddItemCount | 'int32' ddItemCount | 'int16' ddItemCount | 'int8' ddItemCount ; fieldInit : 'float32' '(' float64 ')' | 'float64' '(' float64 ')' | 'float32' '(' int64 ')' | 'float64' '(' int64 ')' | 'int64' '(' int64 ')' | 'int32' '(' int64 ')' | 'int16' '(' int64 ')' | 'char' '(' int64 ')' | 'int8' '(' int64 ')' | 'bool' '(' truefalse ')' | compQstring | bytearrayhead bytes ')' | 'nullref' ; bytearrayhead : 'bytearray' '(' ; bytes : /* EMPTY */ | hexbytes ; hexbytes : HEXBYTE | hexbytes HEXBYTE ; instr_r_head : INSTR_R '(' ; instr_tok_head : INSTR_TOK ; methodSpec : 'method' ; instr : INSTR_NONE | INSTR_VAR int32 | INSTR_VAR id | INSTR_I int32 | INSTR_I8 int64 | INSTR_R float64 | INSTR_R int64 | instr_r_head bytes ')' | INSTR_BRTARGET int32 | INSTR_BRTARGET id | INSTR_METHOD callConv type typeSpec '::' methodName '(' sigArgs0 ')' | INSTR_METHOD callConv type methodName '(' sigArgs0 ')' | INSTR_FIELD type typeSpec '::' id | INSTR_FIELD type id | INSTR_TYPE typeSpec | INSTR_STRING compQstring | INSTR_STRING bytearrayhead bytes ')' | INSTR_SIG callConv type '(' sigArgs0 ')' | INSTR_RVA id | INSTR_RVA int32 | instr_tok_head ownerType /* ownerType ::= memberRef | typeSpec */ | INSTR_SWITCH '(' labels ')' | INSTR_PHI int16s ; sigArgs0 : /* EMPTY */ | sigArgs1 ; sigArgs1 : sigArg | sigArgs1 ',' sigArg ; sigArg : '...' | paramAttr type | paramAttr type id | paramAttr type 'marshal' '(' nativeType ')' | paramAttr type 'marshal' '(' nativeType ')' id ; name1 : id | DOTTEDNAME | name1 '.' name1 ; className : '[' name1 ']' slashedName | '[' '.module' name1 ']' slashedName | slashedName ; slashedName : name1 | slashedName '/' name1 ; typeSpec : className | '[' name1 ']' | '[' '.module' name1 ']' | type ; callConv : 'instance' callConv | 'explicit' callConv | callKind ; callKind : /* EMPTY */ | 'default' | 'vararg' | 'unmanaged' 'cdecl' | 'unmanaged' 'stdcall' | 'unmanaged' 'thiscall' | 'unmanaged' 'fastcall' ; nativeType : /* EMPTY */ | 'custom' '(' compQstring ',' compQstring ',' compQstring ',' graphics/ccc.gif compQstring ')' | 'custom' '(' compQstring ',' compQstring ')' | 'fixed' 'sysstring' '[' int32 ']' | 'fixed' 'array' '[' int32 ']' | 'variant' | 'currency' | 'syschar' | 'void' | 'bool' | 'int8' | 'int16' | 'int32' | 'int64' | 'float32' | 'float64' | 'error' | 'unsigned' 'int8' | 'unsigned' 'int16' | 'unsigned' 'int32' | 'unsigned' 'int64' | nativeType '*' | nativeType '[' ']' | nativeType '[' int32 ']' | nativeType '[' int32 '+' int32 ']' | nativeType '[' '+' int32 ']' | 'decimal' | 'date' | 'bstr' | 'lpstr' | 'lpwstr' | 'lptstr' | 'objectref' | 'iunknown' | 'idispatch' | 'struct' | 'interface' | 'safearray' variantType | 'safearray' variantType ',' compQstring | 'int' | 'unsigned' 'int' | 'nested' 'struct' | 'byvalstr' | 'ansi' 'bstr' | 'tbstr' | 'variant' 'bool' | methodSpec | 'as' 'any' | 'lpstruct' ; variantType : /* EMPTY */ | 'null' | 'variant' | 'currency' | 'void' | 'bool' | 'int8' | 'int16' | 'int32' | 'int64' | 'float32' | 'float64' | 'unsigned' 'int8' | 'unsigned' 'int16' | 'unsigned' 'int32' | 'unsigned' 'int64' | '*' | variantType '[' ']' | variantType 'vector' | variantType '&' | 'decimal' | 'date' | 'bstr' | 'lpstr' | 'lpwstr' | 'iunknown' | 'idispatch' | 'safearray' | 'int' | 'unsigned' 'int' | 'error' | 'hresult' | 'carray' | 'userdefined' | 'record' | 'filetime' | 'blob' | 'stream' | 'storage' | 'streamed_object' | 'stored_object' | 'blob_object' | 'cf' | 'clsid' ; type : 'class' className | 'object' | 'string' | 'value' 'class' className | 'valuetype' className | type '[' ']' | type '[' bounds1 ']' /* uncomment when and if this type is supported by the Runtime | type 'value' '[' int32 ']' */ | type '&' | type '*' | type 'pinned' | type 'modreq' '(' className ')' | type 'modopt' '(' className ')' | '!' int32 | methodSpec callConv type '*' '(' sigArgs0 ')' | 'typedref' | 'char' | 'void' | 'bool' | 'int8' | 'int16' | 'int32' | 'int64' | 'float32' | 'float64' | 'unsigned' 'int8' | 'unsigned' 'int16' | 'unsigned' 'int32' | 'unsigned' 'int64' | 'native' 'int' | 'native' 'unsigned' 'int' | 'native' 'float' ; bounds1 : bound | bounds1 ',' bound ; bound : /* EMPTY */ | '...' | int32 | int32 '...' int32 | int32 '...' ; labels : /* empty */ | id ',' labels | int32 ',' labels | id | int32 ; id : ID | SQSTRING ; int16s : /* EMPTY */ | int16s int32 ; int32 : INT64 ; int64 : INT64 ; float64 : FLOAT64 | 'float32' '(' int32 ')' | 'float64' '(' int64 ')' ; secDecl : '.permission' secAction typeSpec '(' nameValPairs ')' | '.permission' secAction typeSpec | psetHead bytes ')' ; psetHead : '.permissionset' secAction '=' '(' ; nameValPairs : nameValPair | nameValPair ',' nameValPairs ; nameValPair : compQstring '=' caValue ; truefalse : 'true' | 'false' ; caValue : truefalse | int32 | 'int32' '(' int32 ')' | compQstring | className '(' 'int8' ':' int32 ')' | className '(' 'int16' ':' int32 ')' | className '(' 'int32' ':' int32 ')' | className '(' int32 ')' ; secAction : 'request' | 'demand' | 'assert' | 'deny' | 'permitonly' | 'linkcheck' | 'inheritcheck' | 'reqmin' | 'reqopt' | 'reqrefuse' | 'prejitgrant' | 'prejitdeny' | 'noncasdemand' | 'noncaslinkdemand' | 'noncasinheritance' ; extSourceSpec : '.line' int32 SQSTRING | '.line' int32 | '.line' int32 ':' int32 SQSTRING | '.line' int32 ':' int32 | P_LINE int32 QSTRING ; fileDecl : '.file' fileAttr name1 fileEntry hashHead bytes ')' fileEntry | '.file' fileAttr name1 fileEntry ; fileAttr : /* EMPTY */ | fileAttr 'nometadata' ; fileEntry : /* EMPTY */ | '.entrypoint' ; hashHead : '.hash' '=' '(' ; assemblyHead : '.assembly' asmAttr name1 ; asmAttr : /* EMPTY */ | asmAttr 'noappdomain' | asmAttr 'noprocess' | asmAttr 'nomachine' ; assemblyDecls : /* EMPTY */ | assemblyDecls assemblyDecl ; assemblyDecl : '.hash' 'algorithm' int32 | secDecl | asmOrRefDecl ; asmOrRefDecl : publicKeyHead bytes ')' | '.ver' int32 ':' int32 ':' int32 ':' int32 | '.locale' compQstring | localeHead bytes ')' | customAttrDecl ; publicKeyHead : '.publickey' '=' '(' ; publicKeyTokenHead : '.publickeytoken' '=' '(' ; localeHead : '.locale' '=' '(' ; assemblyRefHead : '.assembly' 'extern' name1 | '.assembly' 'extern' name1 'as' name1 ; assemblyRefDecls : /* EMPTY */ | assemblyRefDecls assemblyRefDecl ; assemblyRefDecl : hashHead bytes ')' | asmOrRefDecl | publicKeyTokenHead bytes ')' ; comtypeHead : '.class' 'extern' comtAttr name1 ; exportHead : '.export' comtAttr name1 ; comtAttr : /* EMPTY */ | comtAttr 'private' | comtAttr 'public' | comtAttr 'nested' 'public' | comtAttr 'nested' 'private' | comtAttr 'nested' 'family' | comtAttr 'nested' 'assembly' | comtAttr 'nested' 'famandassem' | comtAttr 'nested' 'famorassem' ; comtypeDecls : /* EMPTY */ | comtypeDecls comtypeDecl ; comtypeDecl : '.file' name1 | '.class' 'extern' name1 | '.class' int32 | customAttrDecl ; manifestResHead : '.mresource' manresAttr name1 ; manresAttr : /* EMPTY */ | manresAttr 'public' | manresAttr 'private' ; manifestResDecls : /* EMPTY */ | manifestResDecls manifestResDecl ; manifestResDecl : '.file' name1 'at' int32 | '.assembly' 'extern' name1 | customAttrDecl ;

C.4 Instruction Syntax

While each section specifies the exact list of instructions that are included in a grammar class, this information is subject to change over time. The precise format of an instruction can be found by combining the information in Partition V, section C.1 with the information in the following Table 8-1.

Table 8-1. Instruction Syntax Classes

Grammar Class

Format(s) Specified in Partition V, Section C.1 Ilasm Keywords

<instr_brtarget>

InlineBrTarget, ShortInlineBrTarget

<instr_field>

InlineField

<instr_i>

InlineI, ShortInlineI

<instr_i8>

InlineI8

<instr_method>

InlineMethod

<instr_none>

InlineNone

<instr_phi>

InlinePhi

<instr_r>

InlineR, ShortInlineR

<instr_rva>

InlineRVA

<instr_sig>

InlineSig

<instr_string>

InlineString

<instr_switch>

InlineSwitch

<instr_tok>

InlineTok

<instr_type>

InlineType

<instr_var>

InlineVar, ShortInlineVar

ANNOTATION

The information in this section is derived from the file opcode.def. It shows all the instructions broken out by argument type.


C.4.1 Top-Level Instruction Syntax
 
 <instr> ::=     <instr_brtarget> <int32>   | <instr_brtarget> <label>   | <instr_field> <type> [ <typeSpec> :: ] <id>   | <instr_i> <int32>   | <instr_i8> <int64>   | <instr_method>       <callConv> <type> [ <typeSpec> :: ]           <methodName> ( <parameters> )   | <instr_none>   | <instr_phi> <int16>*   | <instr_r> ( <bytes> )     // <bytes> represent the binary image of                               // float or double (4 or 8 bytes,                               // respectively)   | <instr_r> <float64>   | <instr_r> <int64>  // integer is converted to float                               // with possible                               // loss of precision   | <instr_sig> <callConv> <type> ( <parameters> )   | <instr_string> bytearray ( <bytes> )   | <instr_string> <QSTRING>   | <instr_switch> ( <labels> )   | <instr_tok> field <type> [ <typeSpec> :: ] <id>   | <instr_tok> b       <callConv> <type> [ <typeSpec> :: ]           <methodName> ( <parameters> )   | <instr_tok> <typeSpec>   | <instr_type> <typeSpec>   | <instr_var> <int32>   | <instr_var> <localname> 
C.4.2 Instructions with No Operand

These instructions require no operands, so they simply appear by themselves.

 
 <instr> ::= <instr_none> <instr_none> ::= // Derived from opcode.def         add            | add.ovf     | add.ovf.un     | and        |         arglist        | break       | ceq            | cgt        |         cgt.un         | ckfinite    | clt            | clt.un     |         conv.i         | conv.i1     | conv.i2        | conv.i4    |         conv.i8        | conv.ovf.i  | conv.ovf.i.un  | conv.ovf.i1|         conv.ovf.i1.un | conv.ovf.i2 | conv.ovf.i2.un | conv.ovf.i4|         conv.ovf.i4.un | conv.ovf.i8 | conv.ovf.i8.un | conv.ovf.u |         conv.ovf.u.un  | conv.ovf.u1 | conv.ovf.u1.un | conv.ovf.u2|         conv.ovf.u2.un | conv.ovf.u4 | conv.ovf.u4.un | conv.ovf.u8|         conv.ovf.u8.un | conv.r.un   | conv.r4        | conv.r8    |         conv.u         | conv.u1     | conv.u2        | conv.u4    |         conv.u8        | cpblk       | div            | div.un     |         dup            | endfault    | endfilter      | endfinally |         initblk        |             | ldarg.0        | ldarg.1    |         ldarg.2        | ldarg.3     | ldc.i4.0       | ldc.i4.1   |         ldc.i4.2       | ldc.i4.3    | ldc.i4.4       | ldc.i4.5   |         ldc.i4.6       | ldc.i4.7    | ldc.i4.8       | ldc.i4.M1  |         ldelem.i       | ldelem.i1   | ldelem.i2      | ldelem.i4  |         ldelem.i8      | ldelem.r4   | ldelem.r8      | ldelem.ref |         ldelem.u1      | ldelem.u2   | ldelem.u4      | ldind.i    |         ldind.i1       | ldind.i2    | ldind.i4       | ldind.i8   |         ldind.r4       | ldind.r8    | ldind.ref      | ldind.u1   |         ldind.u2       | ldind.u4    | ldlen          | ldloc.0    |         ldloc.1        | ldloc.2     | ldloc.3        | ldnull     |         localloc       | mul         | mul.ovf        | mul.ovf.un |         neg            | nop         | not            | or         |         pop            | refanytype  | rem            | rem.un     |         ret            | rethrow     | shl            | shr        |         shr.un         | stelem.i    | stelem.i1      | stelem.i2  |         stelem.i4      | stelem.i8   | stelem.r4      | stelem.r8  |         stelem.ref     | stind.i     | stind.i1       | stind.i2   |         stind.i4       | stind.i8    | stind.r4       | stind.r8   |         stind.ref      | stloc.0     | stloc.1        | stloc.2    |         stloc.3        | sub         | sub.ovf        | sub.ovf.un |         tail.          | throw       | volatile.      | xor 

Examples:

 
 ldlen not 
C.4.3 Instructions That Refer to Parameters or Local Variables

These instructions take one operand, which references a parameter or local variable of the current method. The variable can be referenced by its number (starting with variable 0) or by name (if the names are supplied as part of a signature using the form that supplies both a type and a name).

 
 <instr> ::= <instr_var> <int32> |             <instr_var> <localname> <instr_var> ::= // Derived from opcode.def                | ldarg    | ldarg.s  | ldarga      ldarga.s  | ldloc    | ldloc.s  | ldloca      ldloca.s  | starg    | starg.s  | stloc      stloc.s 

Examples:

 
 stloc 0          // store into 0th local ldarg X3      // load from argument named X3 
C.4.4 Instructions That Take a Single 32-Bit Integer Argument

These instructions take one operand, which must be a 32-bit integer.

 
 <instr> ::= <instr_i> <int32> <instr_i> ::= // Derived from opcode.def      ldc.i4 | ldc.i4.s | unaligned. 

Examples:

 
 ldc.i4 123456  // Load the number 123456 ldc.i4.s 10    // Load the number 10 
C.4.5 Instructions That Take a Single 64-Bit Integer Argument

These instructions take one operand, which must be a 64-bit integer.

 
 <instr> ::= <instr_i8> <int64> <instr_i8> ::= // Derived from opcode.def      ldc.i8 

Examples:

 
 ldc.i8 0x123456789AB ldc.i8 12 
C.4.6 Instructions That Take a Single Floating Point Argument

These instructions take one operand, which must be a floating point number.

 
       <instr> ::= <instr_r> <float64> |                   <instr_r> <int64>   |                                  <instr_r> ( <bytes> )  // <bytes> is binary image <instr_r> ::= // Derived from opcode.def ldc.r4 | ldc.r8 

Examples:

 
 ldc.r4 10.2 ldc.r4 10 ldc.r4 0x123456789ABCDEF ldc.r8 (00 00 00 00 00 00 F8 FF) 
C.4.7 Branch Instructions

The assembler does not optimize branches. The branch must be specified explicitly as using either the short or the long form of the instruction. If the displacement is too large for the short form, then the assembler will display an error.

 
 <instr> ::=      <instr_brtarget> <int32> |      <instr_brtarget> <label> <instr_brtarget> ::= // Derived from opcode.def                             | beq    | beq.s    | bge    | bge.s    |      bge.un    | bge.un.s   | bgt    | bgt.s    | bgt.un | bgt.un.s |      ble       | ble.s      | ble.un | ble.un.s | blt    | blt.s    |      blt.un    | blt.un.s   | bne.un | bne.un.s | br     | br.s     |      brfalse   | brfalse.s  | brtrue | brtrue.s | leave  | leave.s 

Example:

 
 br.s 22 br foo 
C.4.8 Instructions That Take a Method as an Argument

These instructions reference a method, either in another class (first instruction format) or in the current class (second instruction format).

 
 <instr> ::=    <instr_method>      <callConv> <type> [ <typeSpec> :: ] <methodName> ( <parameters> ) <instr_method> ::= // Derived from opcode.def      call  | callvirt | jmp | ldftn    | ldvirtftn        | newobj 

Examples:

 
 call instance int32 C.D.E::X(class W, native int) ldftn vararg char F(...)// Global Function F 
C.4.9 Instructions That Take a Field of a Class as an Argument

These instructions reference a field of a class.

 
 <instr> ::=      <instr_field> <type> <typeSpec> :: <id> <instr_field> ::= // Derived from opcode.def      ldfld | ldflda | ldsfld | ldsflda | stfld | stsfld 

Examples:

 
 ldfld native int X::IntField stsfld int32 Y::AnotherField 
C.4.10 Instructions That Take a Type as an Argument

These instructions reference a type.

 
 <instr> ::= <instr_type> <typeSpec> <instr_type> ::= // Derived from opcode.def      box     | castclass | cpobj    | initobj | isinst    |      ldelema | ldobj     | mkrefany | newarr  | refanyval |      sizeof  | stobj     | unbox 

Examples:

 
 initobj [mscorlib]System.Console sizeof class X 
C.4.11 Instructions That Take a String as an Argument

These instructions take a string as an argument.

 
 <instr> ::= <instr_string> <QSTRING> <instr_string> ::= // Derived from opcode.def      ldstr 

Examples:

 
 ldstr "This is a string" ldstr "This has a\nnewline in it" 
C.4.12 Instructions That Take a Signature as an Argument

These instructions take a stand-alone signature as an argument.

 
 <instr> ::= <instr_sig> <callConv> <type> ( <parameters> ) <instr_sig> ::= // Derived from opcode.def      calli 

Examples:

 
 calli class A.B(wchar *) calli vararg bool(int32[,] X, ...) // Returns a boolean, takes at least one argument. The first // argument, named X, must be a two-dimensional array of // 32-bit ints. 
C.4.13 Instructions That Take a Metadata Token as an Argument

This instruction takes a metadata token as an argument. The token can reference a type, a method, or a field of a class.

 
 <instr> ::= <instr_tok> <typeSpec> |             <instr_tok> method                <callConv> <type> <typeSpec> :: <methodName>                           ( <parameters> ) |             <instr_tok> method                <callConv> <type> <methodName>                           ( <parameters> ) |             <instr_tok> field <type> <typeSpec> :: <id> <instr_tok> ::= // Derived from opcode.def ldtoken 

Examples:

 
 ldtoken class [mscorlib]System.Console ldtoken method int32 X::Fn() ldtoken method bool GlobalFn(int32 &) ldtoken field class X.Y Class::Field 
C.4.14 Switch Instruction

The switch instruction takes a set of labels or decimal relative values.

 
 <instr> ::= <instr_switch> ( <labels> ) <instr_switch> ::= // Derived from opcode.def      switch 

Examples:

 
 switch (0x3, -14, Label1) switch (5, Label2) 


The Common Language Infrastructure Annotated Standard (Microsoft. NET Development Series)
The Common Language Infrastructure Annotated Standard (Microsoft. NET Development Series)
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 121

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net