scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 1c90dd8f2c195e66a1ca9dadfd412a2ccc6dfb55
parent 2b05b5d52482e818baf747bc8b0619fd0d26ca02
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:
Msrc/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: