int drop;
do {
drop = 0;
- while((curr = block_take(&body)) && curr->op != TOP) {
+ while ((curr = block_take(&body)) && curr->op != TOP) {
block b = inst_block(curr);
if (block_count_refs(b,refd) + block_count_refs(b,body) == 0) {
unrefd = BLOCK(unrefd, b);
}
int block_has_main(block top) {
- return top.first && top.first->op == TOP;
+ for (inst *c = top.first; c; c = c->next) {
+ if (c->op == TOP)
+ return 1;
+ }
+ return 0;
}
int block_is_funcdef(block b) {
Exp:
FuncDef Exp %prec ';' {
- if (block_is_funcdef($2))
- $$ = block_bind($1, $2, OP_IS_CALL_PSEUDO);
- else
- $$ = block_bind($1, BLOCK(gen_op_simple(TOP), $2), OP_IS_CALL_PSEUDO);
+ $$ = block_bind_referenced($1, $2, OP_IS_CALL_PSEUDO);
} |
Term "as" '$' IDENT '|' Exp {