[hackers] [scc] [cc2-qbe] Ensure correctness of basic blocks || Roberto E. Vargas Caballero
commit 809d26d10849761118aefc680c9ae7d01b813c4a
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Mon May 9 11:32:51 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Mon May 9 16:39:05 2016 +0200
[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.
diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index 15a703c..b06ff1d 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -225,14 +225,7 @@ cgen(Node *np)
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;
Received on Mon May 09 2016 - 17:00:22 CEST
This archive was generated by hypermail 2.3.0
: Mon May 09 2016 - 17:12:26 CEST