* as/hc08/lkaomf51.c (OutputName),
[fw/sdcc] / src / SDCCsymt.h
index dedf6e857b9394ee384ff471fc17fdafd8a6a178..aae73278c3a7b010a976fa5209a3b72d800f3245 100644 (file)
@@ -60,10 +60,17 @@ enum {
 };
 
 // values for first byte (or 3 most significant bits) of generic pointer.
+#if 0
 #define GPTYPE_FAR       0x00
 #define GPTYPE_NEAR      0x40
 #define GPTYPE_XSTACK    0x60
 #define GPTYPE_CODE      0x80
+#else
+#define GPTYPE_FAR     (port->gp_tags.tag_far)
+#define GPTYPE_NEAR    (port->gp_tags.tag_near)
+#define GPTYPE_XSTACK  (port->gp_tags.tag_xstack)
+#define GPTYPE_CODE    (port->gp_tags.tag_code)
+#endif
 
 #define HASHTAB_SIZE 256
 
@@ -129,6 +136,13 @@ typedef enum
   }
 STORAGE_CLASS;
 
+#define TYPE_TARGET_CHAR  TYPE_BYTE
+#define TYPE_TARGET_INT   TYPE_WORD
+#define TYPE_TARGET_LONG  TYPE_DWORD
+#define TYPE_TARGET_UCHAR TYPE_UBYTE
+#define TYPE_TARGET_UINT  TYPE_UWORD
+#define TYPE_TARGET_ULONG TYPE_UDWORD
+
 /* specifier is the last in the type-chain */
 typedef struct specifier
   {
@@ -154,14 +168,14 @@ typedef struct specifier
     int argreg;                         /* reg no for regparm         */
     union
       {                                 /* Values if constant or enum */
-        TYPE_WORD   v_int;              /* 2 bytes: int and char values           */
-        char       *v_char;             /*          character string              */
-        TYPE_UWORD  v_uint;             /* 2 bytes: unsigned int const value      */
-        TYPE_DWORD  v_long;             /* 4 bytes: long constant value           */
-        TYPE_UDWORD v_ulong;            /* 4 bytes: unsigned long constant value  */
-        double      v_float;            /*          floating point constant value */
-        TYPE_UDWORD v_fixed16x16;       /* 4 bytes: fixed floating point constant value */
-        struct symbol *v_enum;          /* ptr to enum_list if enum==1            */
+        TYPE_TARGET_INT   v_int;        /* 2 bytes: int and char values           */
+        TYPE_TARGET_CHAR *v_char;       /*          character string              */
+        TYPE_TARGET_UINT  v_uint;       /* 2 bytes: unsigned int const value      */
+        TYPE_TARGET_LONG  v_long;       /* 4 bytes: long constant value           */
+        TYPE_TARGET_ULONG v_ulong;      /* 4 bytes: unsigned long constant value  */
+        double            v_float;      /*          floating point constant value */
+        TYPE_TARGET_ULONG v_fixed16x16; /* 4 bytes: fixed floating point constant value */
+        struct symbol    *v_enum;       /* ptr to enum_list if enum==1            */
       }
     const_val;
     struct structdef *v_struct;         /* structure pointer      */
@@ -246,8 +260,8 @@ typedef struct symbol
     char name[SDCC_SYMNAME_MAX + 1];    /* Input Variable Name     */
     char rname[SDCC_NAME_MAX + 1];      /* internal name           */
 
-    short level;                        /* declration lev,fld offset */
-    short block;                        /* sequential block # of defintion */
+    short level;                        /* declaration lev,fld offset */
+    short block;                        /* sequential block # of definition */
     int key;
     unsigned flexArrayLength;           /* if the symbol specifies a struct
     with a "flexible array member", then the additional length in bytes for
@@ -256,6 +270,7 @@ typedef struct symbol
     in the symbol and not in v_struct or the declarator */
     unsigned implicit:1;                /* implicit flag                     */
     unsigned undefined:1;               /* undefined variable                */
+    unsigned infertype:1;               /* type should be inferred from first assign */
     unsigned _isparm:1;                 /* is a parameter          */
     unsigned ismyparm:1;                /* is parameter of the function being generated */
     unsigned isitmp:1;                  /* is an intermediate temp */
@@ -566,7 +581,6 @@ void printSymChain (symbol *, int);
 void printStruct (structdef *, int);
 char *genSymName (int);
 sym_link *getSpec (sym_link *);
-char *genSymName (int);
 int compStructSize (int, structdef *);
 sym_link *copyLinkChain (sym_link *);
 int checkDecl (symbol *, int);
@@ -594,7 +608,7 @@ sym_link *computeType (sym_link *, sym_link *, RESULT_TYPE, int);
 void processFuncPtrArgs (sym_link *);
 void processFuncArgs (symbol *);
 int isSymbolEqual (symbol *, symbol *);
-int powof2 (TYPE_UDWORD);
+int powof2 (TYPE_TARGET_ULONG);
 void printTypeChain (sym_link *, FILE *);
 void printTypeChainRaw (sym_link *, FILE *);
 void initCSupport ();