[hackers] [scc] [cc2] Improve addr() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sat, 16 Apr 2016 09:42:19 +0200 (CEST)

commit 924e73fca9662a6295f2cb5c19be2eac1c2033c9
Author: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
AuthorDate: Fri Apr 15 13:42:42 2016 +0200
Commit: Roberto E. Vargas Caballero <Roberto E. Vargas Caballero>
CommitDate: Fri Apr 15 13:42:42 2016 +0200

    [cc2] Improve addr()
    
    Remove unused op argument and add TMP nodes to
    the list of nodes that can be used in it.

diff --git a/cc2/code.c b/cc2/code.c
index d30693f..da2db80 100644
--- a/cc2/code.c
+++ b/cc2/code.c
_AT_@ -27,21 +27,21 @@ nextpc(void)
 }
 
 static void
-addr(int op, Node *np, Addr *addr)
+addr(Node *np, Addr *addr)
 {
         switch (addr->kind = np->op) {
         case REG:
                 addr->u.reg = np->u.reg;
                 break;
         case CONST:
- /* TODO: different type of constants*/
- np->u.i = np->u.i;
+ abort();
                 break;
         case LABEL:
                 addr->u.sym = np->u.sym;
                 break;
         case AUTO:
- case INDEX:
+ case TMP:
+ addr->u.sym = np->u.sym;
                 break;
         default:
                 abort();
_AT_@ -54,14 +54,14 @@ code(int op, Node *to, Node *from1, Node *from2)
 {
         nextpc();
         if (from1)
- addr(op, from1, &pc->from1);
+ addr(from1, &pc->from1);
         if (from2)
- addr(op, from2, &pc->from2);
+ addr(from2, &pc->from2);
         if (to)
- addr(op, to, &pc->to);
+ addr(to, &pc->to);
+ pc->op = op;
 }
 
-
 void
 delcode(void)
 {
Received on Sat Apr 16 2016 - 09:42:19 CEST

This archive was generated by hypermail 2.3.0 : Sat Apr 16 2016 - 09:48:26 CEST