]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
more fixes
authorRudolf Polzer <divverent@xonotic.org>
Wed, 2 May 2012 12:38:52 +0000 (14:38 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 2 May 2012 12:38:52 +0000 (14:38 +0200)
misc/tools/progs-analyzer.pl

index ee6fb82b08b7e62213b0f9affc58d6b7a3aac3f0..58792a5c240acfcb7c6bb8743d74f7e89511819f 100644 (file)
@@ -360,6 +360,14 @@ sub disassemble_function($$;$)
 
        print "$func->{debugname}:\n";
 
+       if($func->{first_statement} < 0) # builtin
+       {
+               printf INSTRUCTION_FORMAT, '', '', '.BUILTIN';
+               printf OPERAND_FORMAT, -$func->{first_statement};
+               print INSTRUCTION_SEPARATOR;
+               return;
+       }
+
        my $initializer = sub
        {
                my ($ofs) = @_;
@@ -530,7 +538,6 @@ sub find_uninitialized_locals($$)
 {
        my ($progs, $func) = @_;
 
-
        return
                if $func->{first_statement} < 0; # builtin
 
@@ -1053,7 +1060,7 @@ sub detect_constants($)
        $progs->{temps} = \%istemp;
 
        # globaldefs
-       my @globaldefs = (undef) x @{$progs->{globaldefs}};
+       my @globaldefs = (undef) x @{$progs->{globals}};
        for(@{$progs->{globaldefs}})
        {
                $globaldefs[$_->{ofs}] //= $_
@@ -1345,6 +1352,13 @@ sub parse_progs($)
        print STDERR "Detecting constants and temps, and naming...\n";
        detect_constants \%p;
 
+       if($ENV{DUMP})
+       {
+               use Data::Dumper;
+               print Dumper \%p;
+               return;
+       }
+
        # what do we want to do?
        my $checkfunc = \&find_uninitialized_locals;
        if($ENV{DISASSEMBLE})