unsigned char level; /* Nesting level */
struct symbol *fields; /* pointer to fields */
unsigned size; /* sizeof the table in bytes */
+ int type; /* STRUCT or UNION */
}
structdef;
struct iCode *fuse; /* furthest use */
struct iCode *rematiCode; /* rematerialse with which instruction */
struct operand *reqv; /* register equivalent of a local variable */
+ struct symbol *prereqv; /* symbol before register equiv. substituion */
union
{
struct symbol *spillLoc; /* register spil location */
unsigned offset; /* offset from top if struct */
int lineDef; /* defined line number */
+ char *fileDef; /* defined filename */
int lastLine; /* for functions the last line */
struct sym_link *type; /* 1st link to declator chain */
struct sym_link *etype; /* last link to declarator chn */
#define SPEC_NOUN(x) validateLink(x, "SPEC_NOUN", #x, SPECIFIER, __FILE__, __LINE__)->select.s.noun
#define SPEC_LONG(x) validateLink(x, "SPEC_LONG", #x, SPECIFIER, __FILE__, __LINE__)->select.s._long
+#define SPEC_SHORT(x) validateLink(x, "SPEC_LONG", #x, SPECIFIER, __FILE__, __LINE__)->select.s._short
#define SPEC_USIGN(x) validateLink(x, "SPEC_USIGN", #x, SPECIFIER, __FILE__, __LINE__)->select.s._unsigned
#define SPEC_SCLS(x) validateLink(x, "SPEC_SCLS", #x, SPECIFIER, __FILE__, __LINE__)->select.s.sclass
#define SPEC_ENUM(x) validateLink(x, "SPEC_ENUM", #x, SPECIFIER, __FILE__, __LINE__)->select.s._isenum
#define IS_BITVAR(x) (IS_SPEC(x) && (x->select.s.noun == V_BITFIELD || \
x->select.s.noun == V_BIT || \
x->select.s.noun == V_SBIT ))
+#define IS_BIT(x) (IS_SPEC(x) && (x->select.s.noun == V_BIT || \
+ x->select.s.noun == V_SBIT ))
#define IS_FLOAT(x) (IS_SPEC(x) && x->select.s.noun == V_FLOAT)
#define IS_ARITHMETIC(x) (IS_INTEGRAL(x) || IS_FLOAT(x))
#define IS_AGGREGATE(x) (IS_ARRAY(x) || IS_STRUCT(x))
#include "SDCCval.h"
+typedef enum
+{
+ RESULT_TYPE_NONE = 0, /* operands will be promoted to int */
+ RESULT_CHECK = 0, /* TODO: replace all occurences with the appropriate type and remove me */
+ RESULT_TYPE_BIT,
+ RESULT_TYPE_CHAR,
+ RESULT_TYPE_INT,
+ RESULT_TYPE_OTHER, /* operands will be promoted to int */
+ RESULT_TYPE_IFX,
+} RESULT_TYPE;
+
/* forward definitions for the symbol table related functions */
void initSymt ();
symbol *newSymbol (char *, int);
sym_link *newCharLink ();
sym_link *newLongLink ();
int compareType (sym_link *, sym_link *);
+int compareTypeExact (sym_link *, sym_link *, int);
int checkFunction (symbol *, symbol *);
void cleanUpLevel (bucket **, int);
void cleanUpBlock (bucket **, int);
void addSymChain (symbol *);
sym_link *structElemType (sym_link *, value *);
symbol *getStructElement (structdef *, symbol *);
-sym_link *computeType (sym_link *, sym_link *);
+sym_link *computeType (sym_link *, sym_link *, RESULT_TYPE, int);
void processFuncArgs (symbol *);
int isSymbolEqual (symbol *, symbol *);
-int powof2 (unsigned long);
+int powof2 (TYPE_UDWORD);
void printTypeChain (sym_link *, FILE *);
void printTypeChainRaw (sym_link *, FILE *);
void initCSupport ();
void checkTypeSanity(sym_link *etype, char *name);
sym_link *typeFromStr (char *) ;
STORAGE_CLASS sclsFromPtr(sym_link *ptr);
+sym_link *newEnumType (symbol *);
+void promoteAnonStructs (int, structdef *);
extern char *nounName(sym_link *); /* noun strings */