commit 1bf4afb0ea8f7d5ca65b893727225f57c576fda9 parent 4d5fd1a5c0e592bc7ead90ff8b0e40ef71ab7391 Author: Roberto E. Vargas Caballero <k0ga@shike2.com> Date: Thu, 23 Jun 2016 16:20:52 +0200 [cc2-qbe] Add support for OCPL and ONEG in sethi() This operators are implemented using another operators, so the best place for doing this operation is in sethi(). Diffstat:
M | cc2/arch/qbe/cgen.c | | | 17 | +++++++++++++++++ |
1 file changed, 17 insertions(+), 0 deletions(-)
diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c @@ -59,7 +59,24 @@ sethi(Node *np) case OCONST: np->address = 11; break; + case OCPL: + np->op = OAND; + rp = newnode(OCONST); + rp->type = np->type; + rp->u.i = 0; + rp->u.i = ~np->u.i; + goto binary; + case ONEG: + np->op = OSUB; + rp = lp; + lp = newnode(OCONST); + lp->type = np->type; + if (np->type.flags & INTF) + lp->u.i = 0; + else + lp->u.f = 0.0; default: + binary: lp = sethi(lp); rp = sethi(rp); break;