ref: d8b42decda0af1265ba2d6a79b1fdbe5fb75e8d2
parent: 2e0d56a3a143cd10b4d0c5163c0c8a37f54ae511
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon May 9 07:32:51 EDT 2016
[cc2-qbe] Ensure correctness of basic blocks We have to take care of how basic blocks are built in QBE, so we have to ensure that all the basic blocks of the program are finalized with a jump of any type. We also need a label in the next statement of a branch, because in branches in QBE we have to use one label for true and another one for false.
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
@@ -225,14 +225,7 @@
if (!np)
return NULL;
- if (np->label) {
- setlabel(np->label);
- if (np->next == NULL) {
- Node *tmp = newnode();
- tmp->op = ORET;
- addstmt(tmp, KEEPCUR);
- }
- }
+ setlabel(np->label);
l = cgen(np->left);
r = cgen(np->right);
tp = &np->type;