[hackers] [scc] [cc2-qbe] Handle left casts in abbreviations || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 3 Feb 2017 15:13:15 +0100 (CET)

commit 183aa643c31403f78ae47e6cd6e86fc639c33c6b
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Feb 3 15:11:48 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Feb 3 15:11:48 2017 +0100

    [cc2-qbe] Handle left casts in abbreviations
    
    Due to the difference of sizes it is possible to have casts in
    the lhs part of an expression, which must be handle out of
    lhs(), because it is only due to the double meaning of
    abbreviations (being a lhs() and rhs()).

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index 50a7b3f..9682039 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -563,6 +563,15 @@ rhs(Node *np, Node *ret)
                         aux2.right = np->right;
                         aux2.left = np->left;
                         r = rhs(&aux2, &aux1);
+ Node aux3;
+ if (l->op == OCAST) {
+ aux3.type = l->left->type;
+ aux3.op = OCAST;
+ aux3.left = r;
+ aux3.right = NULL;
+ r = &aux3;
+ l = l->left;
+ }
                 case 0:
                         /* TODO: see what is the most difficult */
                         lhs(l, &aux2);
Received on Fri Feb 03 2017 - 15:13:15 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 03 2017 - 15:24:30 CET