[hackers] [scc/qbe] [cc2-qbe] Add support for logic negation operator || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 12 Aug 2016 14:48:41 +0200 (CEST)

commit 6a1d5b045462b11e22110e26b220c9ab76e2958c
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Aug 12 14:47:36 2016 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Aug 12 14:47:36 2016 +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.

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index f06b9db..e03609c 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -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);
_AT_@ -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();
Received on Fri Aug 12 2016 - 14:48:41 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 12 2016 - 15:00:19 CEST