ref: a0862978b0a1d5c876db7839cc6905b749291640
parent: 84977e24ad1f367840d132c50b89d090a275ecbc
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Aug 7 13:28:17 EDT 2015
Move storage IR representation to cc.h
--- a/cc1/code.c
+++ b/cc1/code.c
@@ -147,7 +147,6 @@
(*opcode[op])(op, arg);
}
-/* TODO: move these letters to cc.h */
static void
emitvar(Symbol *sym)
{
@@ -154,15 +153,15 @@
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);
}
--- a/inc/cc.h
+++ b/inc/cc.h
@@ -59,6 +59,13 @@
#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);