[xiph-commits] r17752 - trunk/theora/lib/arm
tterribe at svn.xiph.org
tterribe at svn.xiph.org
Mon Dec 13 07:20:34 PST 2010
Author: tterribe
Date: 2010-12-13 07:20:34 -0800 (Mon, 13 Dec 2010)
New Revision: 17752
Modified:
trunk/theora/lib/arm/arm2gnu.pl
Log:
Make arm2gnu.pl emit only one line per input line, if possible.
The changes in r17745 made PROC and ENDP directives emit multiple
lines, leading to mis-matched line numbers between the original RVCT
source and the GNU translation.
gas allows multiple statements per line, so use them to keep the line
numbers in sync.
Also, contrary to the commit message in r17745, function names actually
do show up correctly in valgrind; I was testing the wrong binary.
Modified: trunk/theora/lib/arm/arm2gnu.pl
===================================================================
--- trunk/theora/lib/arm/arm2gnu.pl 2010-12-13 14:34:27 UTC (rev 17751)
+++ trunk/theora/lib/arm/arm2gnu.pl 2010-12-13 15:20:34 UTC (rev 17752)
@@ -100,20 +100,29 @@
s/\bCODE16\b/.code 16/ && do {$thumb = 1};
if (/\bPROC\b/)
{
- $proc = $_;
- $proc =~ s/\s*\b(\w*)\b\s*\bPROC\b\s*/$1/;
- printf("\t.type\t%s, %%function\n",$proc) if ($proc);
- push(@proc_stack, $proc);
- print " .thumb_func" if ($thumb);
+ my $prefix;
+ my $proc;
+ /^([A-Za-z_\.]\w+)\b/;
+ $proc = $1;
+ $prefix = "";
+ if ($proc)
+ {
+ $prefix = $prefix.sprintf("\t.type\t%s, %%function; ",$proc);
+ push(@proc_stack, $proc);
+ s/^[A-Za-z_\.]\w+/$&:/;
+ }
+ $prefix = $prefix."\t.thumb_func; " if ($thumb);
s/\bPROC\b/@ $&/;
+ $_ = $prefix.$_;
}
s/^(\s*)(S|Q|SH|U|UQ|UH)ASX\b/$1$2ADDSUBX/;
s/^(\s*)(S|Q|SH|U|UQ|UH)SAX\b/$1$2SUBADDX/;
if (/\bENDP\b/)
{
+ my $proc;
+ s/\bENDP\b/@ $&/;
$proc = pop(@proc_stack);
- print ".size $proc, .-$proc" if ($proc);
- s/\bENDP\b/@ $&/;
+ $_ = "\t.size $proc, .-$proc".$_ if ($proc);
}
s/\bSUBT\b/@ $&/;
s/\bDATA\b/@ $&/; # DATA directive is deprecated -- Asm guide, p.7-25
@@ -227,6 +236,7 @@
{
my $cmd=$_;
my $value;
+ my $prefix;
my $w1;
my $w2;
my $w3;
@@ -245,25 +255,22 @@
if( $bigend ne "")
{
# big endian
-
- print " .byte 0x".$w1;
- print " .byte 0x".$w2;
- print " .byte 0x".$w3;
- print " .byte 0x".$w4;
+ $prefix = "\t.byte\t0x".$w1.";".
+ "\t.byte\t0x".$w2.";".
+ "\t.byte\t0x".$w3.";".
+ "\t.byte\t0x".$w4."; ";
}
else
{
# little endian
-
- print " .byte 0x".$w4;
- print " .byte 0x".$w3;
- print " .byte 0x".$w2;
- print " .byte 0x".$w1;
+ $prefix = "\t.byte\t0x".$w4.";".
+ "\t.byte\t0x".$w3.";".
+ "\t.byte\t0x".$w2.";".
+ "\t.byte\t0x".$w1."; ";
}
-
+ $_=$prefix.$_;
}
-
if ( /\badrl\b/i )
{
s/\badrl\s+(\w+)\s*,\s*(\w+)/ldr $1,=$2/i;
More information about the commits
mailing list