X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fgenmdesc.pl;h=2247722107cbd07fa26bc1018f73c38090b5b32b;hb=cb21cf251997fb6caecf6406a8b91ebed7af81c9;hp=7216f36529c233ac3683a5c6fcbeb5450085eb57;hpb=9e1f34dd2d7be45b2a3a6b1c133a4a1de8c3d864;p=mono.git diff --git a/mono/mini/genmdesc.pl b/mono/mini/genmdesc.pl index 7216f36529c..2247722107c 100644 --- a/mono/mini/genmdesc.pl +++ b/mono/mini/genmdesc.pl @@ -6,22 +6,27 @@ use strict; no locale; # must keep in sync with mini.h -my @spec_names = qw(dest src1 src2 src3 len clob); +my @spec_names = qw(dest src1 src2 src3 len clob nacl); sub INST_DEST () {return 0;} sub INST_SRC1 () {return 1;} sub INST_SRC2 () {return 2;} sub INST_SRC3 () {return 3;} sub INST_LEN () {return 4;} sub INST_CLOB () {return 5;} +# making INST_NACL the same as INST_MAX is not a mistake, +# INST_NACL writes over INST_LEN, it's not its own field +sub INST_NACL () {return 6;} sub INST_MAX () {return 6;} # this must include all the #defines used in mini-ops.h my @defines = qw (__i386__ __x86_64__ __ppc__ __powerpc__ __ppc64__ __arm__ - __sparc__ sparc __s390__ s390 __ia64__ __alpha__ __mips__); + __sparc__ sparc __s390__ s390 __ia64__ __alpha__ __mips__ __aarch64__); my %table =(); my %template_table =(); my @opcodes = (); +my $nacl = 0; + sub parse_file { my ($define, $file) = @_; @@ -74,12 +79,15 @@ sub load_opcodes if ($arch =~ "__i386__") { $arch_define = "TARGET_X86"; } - if ($arch =~ " __x86_64__") { + if ($arch =~ "__x86_64__") { $arch_define = "TARGET_AMD64"; } if ($arch =~ "__arm__") { $arch_define = "TARGET_ARM"; } + if ($arch =~ "__aarch64__") { + $arch_define = "TARGET_ARM64"; + } parse_file ($arch_define, "$srcdir/mini-ops.h"); return; @@ -164,10 +172,19 @@ sub build_spec { } #print "vals: " . join (' ', @vals) . "\n"; my $res = ""; + my $n = 0; for (my $i = 0; $i < @vals; ++$i) { + next if $i == INST_NACL; if (defined $vals [$i]) { if ($i == INST_LEN) { - $res .= sprintf ("\\x%x\" \"", +$vals [$i]); + $n = $vals [$i]; + if ($n =~ /[^0-9]/) { + die "Invalid instruction length $n\n"; + } + if ((defined $vals [INST_NACL]) and $nacl == 1){ + $n = $vals [INST_NACL]; + } + $res .= sprintf ("\\x%x\" \"", + $n); } else { if ($vals [$i] =~ /^[a-zA-Z0-9]$/) { $res .= $vals [$i]; @@ -186,11 +203,11 @@ sub build_table { my ($fname, $name) = @_; my $i; my $idx; - my $idx_array = "const guint16 ${name}_idx [] = {\n"; + my $idx_array = "const guint16 mono_${name}_idx [] = {\n"; open (OUT, ">$fname") || die "Cannot open file $fname: $!"; print OUT "/* File automatically generated by genmdesc, don't change */\n\n"; - print OUT "const char $name [] = {\n"; + print OUT "const char mono_$name [] = {\n"; print OUT "\t\"" . ("\\x0" x INST_MAX) . "\"\t/* null entry */\n"; $idx = 1; @@ -215,12 +232,17 @@ sub build_table { } sub usage { - die "genmdesc.pl arch srcdir output name desc [desc2 ...]\n"; + die "genmdesc.pl arch srcdir [--nacl] output name desc [desc2 ...]\n"; } my $arch = shift || usage (); my $srcdir = shift || usage (); my $output = shift || usage (); +if ($output eq "--nacl") +{ + $nacl = 1; + $output = shift || usage(); +} my $name = shift || usage (); usage () unless @ARGV; my @files = @ARGV;