commit a0862978b0a1d5c876db7839cc6905b749291640
Author:     Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Fri Aug 7 17:28:17 2015 +0200
Commit:     Roberto E. Vargas Caballero <[email protected]>
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
@@ -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
@@ -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);

Reply via email to