commit 72e5cb42ece0bd4ad683ee463496d8cbf5458df9
parent 2390716a3f75f8cbf38b5269a51491b6376d5cac
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Mon, 18 Jul 2016 18:22:09 +0200
[cc2-qbe] Convert bool() into void
Bool() is used for control flow code, and it is a
non sense to return some value there, because we
already have rhs() for that.
Diffstat:
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
@@ -177,36 +177,35 @@ lhs(Node *np, Node *new)
}
}
-static Node *
-bool(Node *np, Node *new, Symbol *true, Symbol *false)
+static void
+bool(Node *np, Symbol *true, Symbol *false)
{
Node *l = np->left, *r = np->right;
- Node *ifyes, *ifno;
+ Node ret, *ifyes, *ifno;
Symbol *label;
switch (np->op) {
case OAND:
label = newlabel();
- bool(l, new, label, true);
+ bool(l, label, true);
setlabel(label);
- bool(r, new, true, false);
+ bool(r, true, false);
break;
case OOR:
label = newlabel();
- bool(l, new, true, label);
+ bool(l, true, label);
setlabel(label);
- bool(r, new, true, false);
+ bool(r, true, false);
break;
default:
ifyes = label2node(true);
ifno = label2node(false);
- rhs(l, new);
- code(ASBRANCH, new, ifyes, ifno);
+ rhs(l, &ret);
+ code(ASBRANCH, &ret, ifyes, ifno);
deltree(ifyes);
deltree(ifno);
break;
}
- return new;
}
static Node *
@@ -259,7 +258,7 @@ rhs(Node *np, Node *ret)
case OOR:
true = newlabel();
false = newlabel();
- bool(np, ret, true, false);
+ bool(np, true, false);
setlabel(true);
setlabel(false);
return ret;
@@ -336,7 +335,7 @@ cgen(Node *np)
next->label = newlabel();
ifyes = label2node(np->u.sym);
ifno = label2node(next->label);
- bool(np->left, &n, ifyes->u.sym, ifno->u.sym);
+ bool(np->left, ifyes->u.sym, ifno->u.sym);
code(ASBRANCH, &n, ifyes, ifno);
setlabel(ifyes->u.sym);
setlabel(ifno->u.sym);