4 blit(Ref sd
[2], int sz
, Fn
*fn
)
6 struct { int st
, ld
, cls
, size
; } *p
, tbl
[] = {
7 { Ostorel
, Oload
, Kl
, 8 },
8 { Ostorew
, Oload
, Kw
, 4 },
9 { Ostoreh
, Oloaduh
, Kw
, 2 },
10 { Ostoreb
, Oloadub
, Kw
, 1 }
19 for (n
=p
->size
; sz
>=n
; sz
-=n
) {
21 r
= newtmp("blt", Kl
, fn
);
22 r1
= newtmp("blt", Kl
, fn
);
24 emit(p
->st
, 0, R
, r
, r1
);
25 emit(Oadd
, Kl
, r1
, sd
[1], ro
);
26 r1
= newtmp("blt", Kl
, fn
);
27 emit(p
->ld
, p
->cls
, r
, r1
, R
);
28 emit(Oadd
, Kl
, r1
, sd
[0], ro
);
34 ins(Ins
**pi
, int *new, Blk
*b
, Fn
*fn
)
40 /* simplify more instructions here;
41 * copy 0 into xor, mul 2^n into shift,
42 * bit rotations, ... */
46 assert((i
-1)->op
== Oblit0
);
49 ni
= &b
->ins
[b
->nins
] - (i
+1);
54 blit((i
-1)->arg
, rsval(i
->arg
[0]), fn
);
71 for (b
=fn
->start
; b
; b
=b
->link
) {
73 for (i
=&b
->ins
[b
->nins
]; i
!=b
->ins
;) {
78 b
->nins
= &insb
[NIns
] - curi
;
79 idup(&b
->ins
, curi
, b
->nins
);