1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 10:18:28 +02:00

m1/perf/: calculate effective register allocation and how it in comparison table

This commit is contained in:
Werner Almesberger 2011-09-22 02:07:42 -03:00
parent b3796c855f
commit c5df76a7b9
2 changed files with 21 additions and 5 deletions

View File

@ -3,6 +3,11 @@
sub flush
{
if ($nregs) {
print 0+keys %reg, "/", (sort { $b cmp $a } keys %reg)[0],
"\n";
return;
}
for (sort keys %use) {
print "$_ = ".$reg{$_}."\n";
}
@ -10,6 +15,12 @@ sub flush
}
if ($ARGV[0] eq "-r") {
shift @ARGV;
$nregs = 1;
}
while (<>) {
if (/FPVM fragment:/) {
&flush if $i;
@ -35,11 +46,15 @@ while (<>) {
$e = $1 if /E=(\d+)>/;
die "($i) $_" if $c != $i;
$reg{$a} = 1 if $nregs && defined $a;
$reg{$b} = 1 if $nregs && defined $b;
$a = $reg{$a} if defined $reg{$a};
$b = $reg{$b} if defined $reg{$b};
if ($op eq "IF<R2>") {
$expr = "(IF ".$reg{"R002"}." $a $b)";
$reg{"R002"} = 1 if $nregs;
} elsif ($op eq "VECTOUT") {
$res = "A = $a\nB = $b\n";
} elsif (defined $b) {

View File

@ -24,7 +24,8 @@ eff()
regs()
{
sed '/^regs: 0\//s///p;d' <data/$1/out/$2 | tail -n 1
./eval.pl -r data/$1/out/$2 | sed '1d;s|/.*||'
# sed '/^regs: 0\//s///p;d' <data/$1/out/$2 | tail -n 1
}
@ -45,14 +46,14 @@ eq()
echo "Original New sched (no opt) New sched (LCPF) Equiv Name"
echo "Time Size Eff Time Size Eff Regs Time Size Eff Regs"
echo "Time Size Eff Regs Time Size Eff Regs Time Size Eff Regs"
for n in `ls -1 data/ref/out`; do
ref=`sum ref $n`
new=`sum new $n`
opt=`sum opt $n`
printf "%5.1f %4d%3d%% %5.1f %4d%3d%% %4d %5.1f %4d%3d%% %4d %s " \
`time ref $n` `size ref $n` `eff ref $n` \
printf "%5.1f %4d%3d%% %4d %5.1f %4d%3d%% %4d %5.1f %4d%3d%% %4d %s " \
`time ref $n` `size ref $n` `eff ref $n` `regs ref $n` \
`time new $n` `size new $n` `eff new $n` `regs new $n` \
`time opt $n` `size opt $n` `eff opt $n` `regs opt $n` \
`eq $ref $new`/`eq $ref $opt`/`eq $new $opt`