[hackers] [scc] Move storage IR representation to cc.h || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Fri, 7 Aug 2015 17:29:33 +0200 (CEST)

commit a0862978b0a1d5c876db7839cc6905b749291640
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Aug 7 17:28:17 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Aug 7 17:28:17 2015 +0200

    Move storage IR representation to cc.h

diff --git a/cc1/code.c b/cc1/code.c
index 9857edb..ca9337b 100644
--- a/cc1/code.c
+++ b/cc1/code.c
_AT_@ -147,22 +147,21 @@ emit(unsigned op, void *arg)
         (*opcode[op])(op, arg);
 }
 
-/* TODO: move these letters to cc.h */
 static void
 emitvar(Symbol *sym)
 {
         char c;
 
         if (sym->flags & ISSTATIC)
- c = (sym->flags & ISGLOBAL) ? 'Y' : 'T';
+ c = (sym->flags & ISGLOBAL) ? L_PRIVATE : L_STATIC;
         else if (sym->flags & ISGLOBAL)
- c = 'G';
+ c = L_PUBLIC;
         else if (sym->flags & ISREGISTER)
- c = 'R';
+ c = L_REGISTER;
         else if (sym->flags & ISFIELD)
- c = 'M';
+ c = L_FIELD;
         else
- c = 'A';
+ c = L_AUTO;
         printf("%c%d", c, sym->id);
 }
 
diff --git a/inc/cc.h b/inc/cc.h
index bf7896c..050c904 100644
--- a/inc/cc.h
+++ b/inc/cc.h
_AT_@ -59,6 +59,13 @@ typedef unsigned bool;
 #define L_DOUBLE 'D'
 #define L_LDOUBLE 'H'
 
+#define L_PUBLIC 'G'
+#define L_PRIVATE 'Y'
+#define L_STATIC 'T'
+#define L_REGISTER 'R'
+#define L_FIELD 'M'
+#define L_AUTO 'A'
+
 extern void die(const char *fmt, ...);
 extern void *xmalloc(size_t size);
 extern void *xcalloc(size_t nmemb, size_t size);
Received on Fri Aug 07 2015 - 17:29:33 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 07 2015 - 17:36:11 CEST