[hackers] [scc] [cc2-qbe] Emit abbrev statements || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Mon, 9 May 2016 22:03:54 +0200 (CEST)

commit 30f27528f11cb62062805ee9d854c1011d0933cd
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
AuthorDate: Sun May 8 20:12:18 2016 +0200
Commit: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
CommitDate: Sun May 8 20:12:18 2016 +0200

    [cc2-qbe] Emit abbrev statements
    
    Abbrev statements are the combination of a assignation
    and some other operator, and they don't have special
    meaning in QBE. They must be expanded.

diff --git a/cc2/arch/qbe/cgen.c b/cc2/arch/qbe/cgen.c
index 3af006d..c3facc3 100644
--- a/cc2/arch/qbe/cgen.c
+++ b/cc2/arch/qbe/cgen.c
_AT_@ -231,6 +231,20 @@ cast(Node *nd)
         return nd;
 }
 
+static Node *
+abbrev(Node *np)
+{
+ Node *tmp;
+
+ if (np->u.subop == 0)
+ return np->right;
+ tmp = newnode(np->u.subop);
+ tmp->type = np->type;
+ tmp->right = np->right;
+ tmp->left = np->left;
+ return np->right = cgen(tmp);
+}
+
 Node *
 cgen(Node *np)
 {
_AT_@ -317,6 +331,7 @@ cgen(Node *np)
         case ODEC:
                 abort();
         case OASSIG:
+ r = abbrev(np);
                 switch (tp->size) {
                 case 1:
                         op = ASSTB;
Received on Mon May 09 2016 - 22:03:54 CEST

This archive was generated by hypermail 2.3.0 : Mon May 09 2016 - 22:12:13 CEST