]> git.sur5r.net Git - cc65/blobdiff - src/cc65/symentry.h
More optimizations
[cc65] / src / cc65 / symentry.h
index 82f9458b98ed50d95fab2e11076f01884fe0504a..6fe4ce7f04515e1532805227dc9ec598da9b3214 100644 (file)
@@ -6,10 +6,10 @@
 /*                                                                           */
 /*                                                                           */
 /*                                                                           */
-/* (C) 2000     Ullrich von Bassewitz                                        */
-/*              Wacholderweg 14                                              */
-/*              D-70597 Stuttgart                                            */
-/* EMail:       uz@musoftware.de                                             */
+/* (C) 2000-2001 Ullrich von Bassewitz                                       */
+/*               Wacholderweg 14                                             */
+/*               D-70597 Stuttgart                                           */
+/* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
 /*                                                                           */
 /* This software is provided 'as-is', without any expressed or implied       */
 
 #include <stdio.h>
 
+/* cc65 */
 #include "datatype.h"
 
 
 
 /*****************************************************************************/
-/*                             struct SymEntry                              */
+/*                                 Forwards                                 */
+/*****************************************************************************/
+
+
+
+struct Segments;
+
+
+
+/*****************************************************************************/
+/*                             struct SymEntry                              */
 /*****************************************************************************/
 
 
 
 /* Storage classes and flags */
-#define SC_AUTO        0x0001U
+#define SC_AUTO        0x0001U
 #define SC_REGISTER            0x0002U /* Register variable, is in static storage */
 #define SC_STATIC      0x0004U
 #define SC_EXTERN      0x0008U
 
-#define SC_ENUM                0x0010U /* An enum (numeric constant) */
-#define SC_LABEL               0x0020U /* A goto label */
-#define SC_PARAM               0x0040U /* This is a function parameter */
-#define SC_FUNC                0x0080U /* Function entry */
+#define SC_ENUM                0x0030U /* An enum (numeric constant) */
+#define SC_CONST       0x0020U /* A numeric constant with a type */
+#define SC_LABEL               0x0040U /* A goto label */
+#define SC_PARAM               0x0080U /* This is a function parameter */
+#define SC_FUNC                0x0100U /* Function entry */
 
-#define SC_STORAGE             0x0100U /* Symbol with associated storage */
-#define SC_DEFAULT             0x0200U /* Flag: default storage class was used */
+#define SC_STORAGE             0x0400U /* Symbol with associated storage */
+#define SC_DEFAULT             0x0800U /* Flag: default storage class was used */
 
-#define SC_DEF         0x0400U /* Symbol is defined */
-#define SC_REF                 0x0800U /* Symbol is referenced */
+#define SC_DEF         0x1000U /* Symbol is defined */
+#define SC_REF                 0x2000U /* Symbol is referenced */
 
-#define SC_TYPE                0x1000U /* This is a type, struct, typedef, etc. */
-#define SC_STRUCT              0x1001U /* Struct or union */
-#define SC_SFLD                0x1002U /* Struct or union field */
-#define SC_TYPEDEF             0x1003U /* A typedef */
+#define SC_TYPE                0x4000U /* This is a type, struct, typedef, etc. */
+#define SC_STRUCT              0x4001U /* Struct or union */
+#define SC_SFLD                0x4002U /* Struct or union field */
+#define SC_TYPEDEF             0x4003U /* A typedef */
 
 #define SC_ZEROPAGE    0x8000U /* Symbol marked as zeropage */
 
@@ -82,7 +94,7 @@ struct SymEntry {
     SymEntry*                          NextHash; /* Next entry in hash list */
     SymEntry*                          PrevSym;  /* Previous symbol in dl list */
     SymEntry*                          NextSym;  /* Next symbol double linked list */
-    SymEntry*                          Link;     /* General purpose single linked list */
+    SymEntry*                          Link;     /* General purpose single linked list */
     struct SymTable*           Owner;    /* Symbol table the symbol is in */
     unsigned                           Flags;    /* Symbol flags */
     type*                              Type;     /* Symbol type */
@@ -96,8 +108,8 @@ struct SymEntry {
        /* Label name for static symbols */
        unsigned                Label;
 
-       /* Value for enums */
-       int                     EnumVal;
+       /* Value for constants (including enums) */
+               long                    ConstVal;
 
        /* Data for structs/unions */
        struct {
@@ -106,16 +118,19 @@ struct SymEntry {
        } S;
 
        /* Data for functions */
-       struct FuncDesc*        Func;     /* Function descriptor */
+       struct {
+           struct FuncDesc*    Func;     /* Function descriptor */
+                   struct Segments*    Seg;      /* Segments for this function */
+               } F;
 
     } V;
-    char                              Name[1]; /* Name, dynamically allocated */
+    char                              Name[1]; /* Name, dynamically allocated */
 };
 
 
 
 /*****************************************************************************/
-/*                                  Code                                    */
+/*                                  Code                                    */
 /*****************************************************************************/