3 # make-opcodes-def.pl: Loads the opcodes from the CIL-opcodes.xml and
4 # generates a spec compliant opcodes.def file
7 # Miguel de Icaza (miguel@ximian.com)
9 # (C) 2001 Ximian, Inc.
11 # We should really be doing this with XSLT, but I know nothing about XSLT
15 open OPCODES, "cil-opcodes.xml" || die "Can not open cil-opcodes.xml";
16 open OUTPUT, ">opcode.def" || die "Can not create opcode.def file";
20 next if (!/<opcode .*\/>/);
22 ($name, $input, $output, $args, $o1, $o2, $flow) = $_ =~ /name=\"([\w\.]+)\"\s+input=\"([\w+]+)\"\s+output=\"([\w+]+)\"\s+args=\"(\w+)\"\s+o1=\"0x(\w+)\"\s+o2=\"0x(\w+)\"\s+flow=\"([\w-]+)\"\/>/;
34 $uname =~ tr [a-z] [A-Z];
42 $ff = "NEXT" if ($flow =~ /^next$/);
43 $ff = "CALL" if ($flow =~ /^call$/);
44 $ff = "RETURN" if ($flow =~ /^return$/);
45 $ff = "BRANCH" if ($flow =~ /^branch$/);
46 $ff = "COND_BRANCH" if ($flow =~ /^cond-branch$/);
47 $ff = "META" if ($flow =~ /^meta$/);
49 print OUTPUT "OPDEF(CEE_$uname, \"$name\", $input, $output, $args, X, $count, 0x$o1, 0x$o2, $ff)\n";
55 #define _MONO_CIL_OPALIAS_DEFINED_
56 #define OPALIAS(a,s,r)
59 OPALIAS(CEE_BRNULL, "brnull", CEE_BRFALSE)
60 OPALIAS(CEE_BRNULL_S, "brnull.s", CEE_BRFALSE_S)
61 OPALIAS(CEE_BRZERO, "brzero", CEE_BRFALSE)
62 OPALIAS(CEE_BRZERO_S, "brzero.s", CEE_BRFALSE_S)
63 OPALIAS(CEE_BRINST, "brinst", CEE_BRTRUE)
64 OPALIAS(CEE_BRINST_S, "brinst.s", CEE_BRTRUE_S)
65 OPALIAS(CEE_LDIND_U8, "ldind.u8", CEE_LDIND_I8)
66 OPALIAS(CEE_LDELEM_U8, "ldelem.u8", CEE_LDELEM_I8)
67 OPALIAS(CEE_LDX_I4_MIX, "ldc.i4.M1", CEE_LDC_I4_M1)
68 OPALIAS(CEE_ENDFAULT, "endfault", CEE_ENDFINALLY)
70 #ifdef _MONO_CIL_OPALIAS_DEFINED_
72 #undef _MONO_CIL_OPALIAS_DEFINED_