From c5df76a7b988ca7337c2506ecf6ecdaf4314df85 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Thu, 22 Sep 2011 02:07:42 -0300 Subject: [PATCH] m1/perf/: calculate effective register allocation and how it in comparison table --- m1/perf/eval.pl | 15 +++++++++++++++ m1/perf/tabulate | 11 ++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/m1/perf/eval.pl b/m1/perf/eval.pl index 4f62ef1..3aee1e9 100755 --- a/m1/perf/eval.pl +++ b/m1/perf/eval.pl @@ -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") { $expr = "(IF ".$reg{"R002"}." $a $b)"; + $reg{"R002"} = 1 if $nregs; } elsif ($op eq "VECTOUT") { $res = "A = $a\nB = $b\n"; } elsif (defined $b) { diff --git a/m1/perf/tabulate b/m1/perf/tabulate index d2c80ec..c5d8b1b 100755 --- a/m1/perf/tabulate +++ b/m1/perf/tabulate @@ -24,7 +24,8 @@ eff() regs() { - sed '/^regs: 0\//s///p;d'