3 /* require use, maintains use counts */
13 /* promote uniform stack slots to temporaries */
15 for (i
=b
->ins
; i
<&b
->ins
[b
->nins
]; i
++) {
16 if (Oalloc
> i
->op
|| i
->op
> Oalloc1
)
18 /* specific to NAlign == 3 */
19 assert(rtype(i
->to
) == RTmp
);
20 t
= &fn
->tmp
[i
->to
.val
];
25 for (u
=t
->use
; u
!= &t
->use
[t
->nuse
]; u
++) {
30 if (s
== -1 || s
== loadsz(l
)) {
35 if (req(i
->to
, l
->arg
[1]) && !req(i
->to
, l
->arg
[0]))
36 if (s
== -1 || s
== storesz(l
))
37 if (k
== -1 || k
== optab
[l
->op
].argcls
[0][0]) {
39 k
= optab
[l
->op
].argcls
[0][0];
44 /* get rid of the alloc and replace uses */
45 *i
= (Ins
){.op
= Onop
};
47 ue
= &t
->use
[t
->nuse
];
48 for (u
=t
->use
; u
!=ue
; u
++) {
59 err("slot %%%s is read but never stored to",
60 fn
->tmp
[l
->arg
[0].val
].name
);
61 /* try to turn loads into copies so we
62 * can eliminate them later */
70 if (KBASE(k
) != KBASE(l
->cls
))
77 l
->op
= Oextsb
+ (l
->op
- Oloadsb
);
85 fprintf(stderr
, "\n> After memory optimization:\n");