2 * opcodes.c: CIL instruction information
5 * Paolo Molaro (lupus@ximian.com)
7 * Copyright 2002-2003 Ximian, Inc (http://www.ximian.com)
8 * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
10 #include <mono/metadata/opcodes.h>
11 #include <stddef.h> /* for NULL */
14 #define MONO_PREFIX1_OFFSET MONO_CEE_ARGLIST
15 #define MONO_CUSTOM_PREFIX_OFFSET MONO_CEE_MONO_ICALL
17 #define OPDEF(a,b,c,d,e,f,g,h,i,j) \
18 { Mono ## e, MONO_FLOW_ ## j, MONO_ ## a },
21 mono_opcodes
[MONO_CEE_LAST
+ 1] = {
22 #include "mono/cil/opcode.def"
28 #ifdef HAVE_ARRAY_ELEM_INIT
29 #define MSGSTRFIELD(line) MSGSTRFIELD1(line)
30 #define MSGSTRFIELD1(line) str##line
31 static const struct msgstr_t
{
32 #define OPDEF(a,b,c,d,e,f,g,h,i,j) char MSGSTRFIELD(__LINE__) [sizeof (b)];
33 #include "mono/cil/opcode.def"
36 #define OPDEF(a,b,c,d,e,f,g,h,i,j) b,
37 #include "mono/cil/opcode.def"
40 static const int16_t opidx
[] = {
41 #define OPDEF(a,b,c,d,e,f,g,h,i,j) [MONO_ ## a] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)),
42 #include "mono/cil/opcode.def"
47 mono_opcode_name (int opcode
)
49 return (const char*)&opstr
+ opidx
[opcode
];
53 #define OPDEF(a,b,c,d,e,f,g,h,i,j) b,
54 static const char* const
55 mono_opcode_names
[MONO_CEE_LAST
+ 1] = {
56 #include "mono/cil/opcode.def"
61 mono_opcode_name (int opcode
)
63 return mono_opcode_names
[opcode
];
69 mono_opcode_value (const mono_byte
**ip
, const mono_byte
*end
)
72 const mono_byte
*p
= *ip
;
80 res
= *p
+ MONO_PREFIX1_OFFSET
;
81 } else if (*p
== MONO_CUSTOM_PREFIX
) {
85 res
= *p
+ MONO_CUSTOM_PREFIX_OFFSET
;