scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 6a1d5b045462b11e22110e26b220c9ab76e2958c
parent ed8a3ceb831499cabb4114380b8d5bcc272c1323
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 12 Aug 2016 14:47:36 +0200

[cc2-qbe] Add support for logic negation operator

This operator is very easy because we only have
to change what is the true and what is the false.

Diffstat:
Mcc2/arch/qbe/cgen.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c @@ -187,6 +187,9 @@ bool(Node *np, Symbol *true, Symbol *false) Symbol *label; switch (np->op) { + case ONEG: + bool(l, false, true); + break; case OAND: label = newlabel(); bool(l, label, true); @@ -255,6 +258,7 @@ rhs(Node *np, Node *ret) case OMEM: case OAUTO: return load(np, ret); + case ONEG: case OAND: case OOR: true = newlabel();