| 1 | @ph = ( "", ".few", ".many" ); |
| 2 | @bwh = ( ".sptk", ".spnt", ".dptk", ".dpnt" ); |
| 3 | @dh = ( "", ".clr" ); |
| 4 | |
| 5 | @iprel = ( ".cond", ".wexit", ".wtop", ".cloop", ".cexit", ".ctop", ".call" ); |
| 6 | @indir = ( ".cond", ".ia", ".ret", ".call" ); |
| 7 | %noqual = ( ".ia", 1, ".cloop", 1, ".ctop", 1, ".cexit", 1 ); |
| 8 | %slottwo = ( ".cloop", 1, ".ctop", 1, ".cexit", 1, ".wtop", 1, ".wexit", 1 ); |
| 9 | |
| 10 | print ".L0:\n\n"; |
| 11 | |
| 12 | foreach $i (@iprel) { |
| 13 | $call = ($i eq ".call" ? "b0 = " : ""); |
| 14 | foreach $b (@bwh) { |
| 15 | foreach $p (@ph) { |
| 16 | foreach $d (@dh) { |
| 17 | if ($slottwo{$i}) { |
| 18 | if (!$noqual{$i}) { |
| 19 | print ("\t{ .bbb; (p2) br${i}${b}${p}${d} ${call}.L1 ;; }\n"); |
| 20 | } |
| 21 | print ("\t{ .bbb; br${i}${b}${p}${d} ${call}.L1 ;; }\n"); |
| 22 | } else { |
| 23 | print ("\t{ .bbb; nop.b 0\n"); |
| 24 | if (!$noqual{$i}) { |
| 25 | print ("(p2)\tbr${i}${b}${p}${d} ${call}.L1\n"); |
| 26 | } else { |
| 27 | print ("\tnop.b 0\n"); |
| 28 | } |
| 29 | print ("\tbr${i}${b}${p}${d} ${call}.L0\n"); |
| 30 | print ("\t;; }\n"); |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | print "\n"; |
| 36 | } |
| 37 | |
| 38 | foreach $i (@indir) { |
| 39 | $call = ($i eq ".call" ? "b0 = " : ""); |
| 40 | foreach $b (@bwh) { |
| 41 | foreach $p (@ph) { |
| 42 | foreach $d (@dh) { |
| 43 | print ("\t{ .bbb; nop.b 0;\n"); |
| 44 | if (!$noqual{$i}) { |
| 45 | print ("(p2)\tbr${i}${b}${p}${d} ${call}b2\n"); |
| 46 | } else { |
| 47 | print ("\tnop.b 0\n"); |
| 48 | } |
| 49 | print ("\tbr${i}${b}${p}${d} ${call}b2\n"); |
| 50 | print ("\t;; }\n"); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | print "\n"; |
| 55 | } |
| 56 | |
| 57 | @ih = ( "", ".imp" ); |
| 58 | @ipwh = ( ".sptk", ".loop", ".dptk", ".exit" ); |
| 59 | @indwh = ( ".sptk", ".dptk" ); |
| 60 | |
| 61 | $CTR = 2; |
| 62 | |
| 63 | foreach $w (@ipwh) { |
| 64 | foreach $i (@ih) { |
| 65 | print ("\t{ .bbb; break.b 0; nop.b 0\n"); |
| 66 | print ("\tbrp${w}${i} .L0, .L${CTR}\n"); |
| 67 | print ("\t;; }\n"); |
| 68 | } |
| 69 | print (".L${CTR}:\n"); |
| 70 | ++$CTR; |
| 71 | } |
| 72 | |
| 73 | print "\n"; |
| 74 | |
| 75 | foreach $b ("", ".ret") { |
| 76 | foreach $w (@indwh) { |
| 77 | foreach $i (@ih) { |
| 78 | print ("\t{ .bbb; break.b 0; nop.b 0\n"); |
| 79 | print ("\tbrp${b}${w}${i} b3, .L${CTR}\n"); |
| 80 | print ("\t;; }\n"); |
| 81 | } |
| 82 | print (".L${CTR}:\n"); |
| 83 | ++$CTR; |
| 84 | } |
| 85 | print "\n"; |
| 86 | } |
| 87 | |
| 88 | print ".space 5888\n"; |
| 89 | |
| 90 | @last = ( "cover", "clrrrb", "clrrrb.pr", "rfi", "bsw.0", "bsw.1", "epc" ); |
| 91 | foreach $i (@last) { |
| 92 | print "\t{ .bbb; nop.b 0; nop.b 0; $i ;; }\n"; |
| 93 | } |
| 94 | |
| 95 | print "\n.L1:\n"; |