commit b610edb2ef5a3c07cc8e3490434abffd6eccbfc1 parent d345cbc168b653ee8338863aa8e0769f6758119c Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Thu, 4 Nov 2021 08:16:30 +0100 cc2/qbe: Simplify sethi() The frontend is filtering all the cases where we can have a cast in the lhs, so the only case where the cast can happen is in an abbreviation. For this reason we don't have to check the suboperation of the assignment. Diffstat:
M | src/cmd/cc/cc2/target/qbe/cgen.c | | | 22 | +++++++++------------- |
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/cmd/cc/cc2/target/qbe/cgen.c b/src/cmd/cc/cc2/target/qbe/cgen.c @@ -696,7 +696,6 @@ cgen(Node *np) Node * sethi(Node *np) { - int op; Node *lp, *rp; if (!np) @@ -715,18 +714,15 @@ sethi(Node *np) np->address = 11; break; case OASSIG: - op = np->u.subop; - if (op != OINC && op != ODEC) { - if (lp->op == OCAST) { - Node *tmp = node(OCAST); - tmp->type = lp->left->type; - tmp->left = rp; - tmp->right = NULL; - rp = tmp; - tmp = lp; - lp = lp->left; - delnode(tmp); - } + if (lp->op == OCAST) { + Node *tmp = node(OCAST); + tmp->type = lp->left->type; + tmp->left = rp; + tmp->right = NULL; + rp = tmp; + tmp = lp; + lp = lp->left; + delnode(tmp); } goto binary; case OCPL: