2 * opcodes.c: CIL instruction information
5 * Paolo Molaro (lupus@ximian.com)
7 * (C) 2002 Ximian, Inc.
9 #include <mono/metadata/opcodes.h>
10 #include <stddef.h> /* for NULL */
13 #define MONO_PREFIX1_OFFSET MONO_CEE_ARGLIST
14 #define MONO_CUSTOM_PREFIX_OFFSET MONO_CEE_MONO_ICALL
16 #define OPDEF(a,b,c,d,e,f,g,h,i,j) \
17 { Mono ## e, MONO_FLOW_ ## j, MONO_ ## a },
20 mono_opcodes [MONO_CEE_LAST + 1] = {
21 #include "mono/cil/opcode.def"
27 #ifdef HAVE_ARRAY_ELEM_INIT
28 #define MSGSTRFIELD(line) MSGSTRFIELD1(line)
29 #define MSGSTRFIELD1(line) str##line
30 static const struct msgstr_t {
31 #define OPDEF(a,b,c,d,e,f,g,h,i,j) char MSGSTRFIELD(__LINE__) [sizeof (b)];
32 #include "mono/cil/opcode.def"
35 #define OPDEF(a,b,c,d,e,f,g,h,i,j) b,
36 #include "mono/cil/opcode.def"
39 static const gint16 opidx [] = {
40 #define OPDEF(a,b,c,d,e,f,g,h,i,j) [MONO_ ## a] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)),
41 #include "mono/cil/opcode.def"
46 mono_opcode_name (int opcode)
48 return (const char*)&opstr + opidx [opcode];
52 #define OPDEF(a,b,c,d,e,f,g,h,i,j) b,
53 static const char* const
54 mono_opcode_names [MONO_CEE_LAST + 1] = {
55 #include "mono/cil/opcode.def"
60 mono_opcode_name (int opcode)
62 return mono_opcode_names [opcode];
68 mono_opcode_value (const guint8 **ip, const guint8 *end)
71 const guint8 *p = *ip;
79 res = *p + MONO_PREFIX1_OFFSET;
80 } else if (*p == MONO_CUSTOM_PREFIX) {
84 res = *p + MONO_CUSTOM_PREFIX_OFFSET;