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
13 # or maybe just an XML::Parser... - lupus
19 # the XML file also includes "throw"
20 @valid_flow{qw(next call return branch meta cond-branch)} = ();
22 open OUTPUT
, ">$ARGV[1]" || die "Can not create $ARGV[1] file: $!";
24 my $parser = new XML
::Parser
(Handlers
=> {Start
=> \
&handle_opcode
});
26 $parser->parsefile($ARGV[0]);
28 close(OUTPUT
) || die "Can not close file: $!";
31 my ($parser, $elem, %attrs) = @_;
32 my ($name, $input, $output, $args, $o1, $o2, $flow, $uname, $count, $ff);
34 return if ($elem ne 'opcode');
36 ($name, $input, $output, $args, $o1, $o2, $flow) =
37 @attrs{qw(name input output args o1 o2 flow)};
41 if (hex($o1) == 0xff){
48 if (exists $valid_flow{$flow}) {
53 print OUTPUT
"OPDEF(CEE_$uname, \"$name\", $input, $output, $args, X, $count, $o1, $o2, $ff)\n";
59 /* GENERATED FILE, DO NOT EDIT */
66 #define _MONO_CIL_OPALIAS_DEFINED_
67 #define OPALIAS(a,s,r)
70 OPALIAS(CEE_BRNULL, "brnull", CEE_BRFALSE)
71 OPALIAS(CEE_BRNULL_S, "brnull.s", CEE_BRFALSE_S)
72 OPALIAS(CEE_BRZERO, "brzero", CEE_BRFALSE)
73 OPALIAS(CEE_BRZERO_S, "brzero.s", CEE_BRFALSE_S)
74 OPALIAS(CEE_BRINST, "brinst", CEE_BRTRUE)
75 OPALIAS(CEE_BRINST_S, "brinst.s", CEE_BRTRUE_S)
76 OPALIAS(CEE_LDIND_U8, "ldind.u8", CEE_LDIND_I8)
77 OPALIAS(CEE_LDELEM_U8, "ldelem.u8", CEE_LDELEM_I8)
78 OPALIAS(CEE_LDX_I4_MIX, "ldc.i4.M1", CEE_LDC_I4_M1)
79 OPALIAS(CEE_ENDFAULT, "endfault", CEE_ENDFINALLY)
81 #ifdef _MONO_CIL_OPALIAS_DEFINED_
83 #undef _MONO_CIL_OPALIAS_DEFINED_