2011-09-18 06:51:17 +03:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
2011-09-18 16:14:12 +03:00
|
|
|
while (<>) {
|
|
|
|
last if /per-vertex PFPU fragment/;
|
|
|
|
}
|
2011-09-18 06:51:17 +03:00
|
|
|
|
|
|
|
$i = 0;
|
|
|
|
while (<>) {
|
|
|
|
next unless
|
|
|
|
/^(\d+):\s+(\S+)\s+(R\d+)?(,(R\d+))?.*?(->\s+(R\d+))?\s*$/;
|
|
|
|
# 1 2 3 4 5 6 7
|
|
|
|
($c, $op, $a, $b, $d) = ($1, $2, $3, $5, $7);
|
|
|
|
undef $e;
|
|
|
|
$e = $1 if /E=(\d+)>/;
|
|
|
|
die if $c != $i;
|
|
|
|
|
|
|
|
$a = $reg{$a} if defined $reg{$a};
|
|
|
|
$b = $reg{$b} if defined $reg{$b};
|
|
|
|
|
2011-09-18 16:14:12 +03:00
|
|
|
if ($op eq "IF<R2>") {
|
|
|
|
$expr = "(IF ".$reg{"R002"}." $a $b)";
|
2011-09-18 06:51:17 +03:00
|
|
|
} elsif ($op eq "VECTOUT") {
|
|
|
|
$res = "$a\n$b\n";
|
|
|
|
} elsif (defined $b) {
|
|
|
|
$expr = "($op $a $b)";
|
|
|
|
} elsif (defined $a) {
|
|
|
|
$expr = "($op $a)";
|
|
|
|
} else {
|
|
|
|
$expr = "($op)";
|
|
|
|
}
|
|
|
|
|
|
|
|
$val[$e] = $expr if defined $e;
|
|
|
|
$reg{$d} = $val[$i] if defined $d;
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
print $res;
|