fixed a warning about the new enum ASTTYPE
[fw/sdcc] / src / SDCCast.h
index 32fe46922c9e6b8d960eaf5c4b87c835155c445e..24cc4f7aebcc29d398935c85631509a14392eaa5 100644 (file)
 #include "SDCCset.h"
 #include "SDCCmem.h"
 
-#define  EX_OP       0
-#define  EX_VALUE    1
-#define  EX_LINK     2
-#define  EX_STMNT    3
-#define  EX_OPERAND  4
+typedef enum {
+  EX_OP=0,
+  EX_VALUE,
+  EX_LINK,
+  EX_OPERAND
+} ASTTYPE;
 
 /* expression tree   */
 typedef struct ast
   {
 
-    unsigned type:3;
+    ASTTYPE type;
     unsigned decorated:1;
     unsigned isError:1;
     unsigned funcName:1;
@@ -56,7 +57,6 @@ typedef struct ast
        value *val;             /* value if type = EX_VALUE */
        sym_link *lnk;          /* sym_link * if type= EX_LINK  */
        struct operand *oprnd;  /* used only for side effecting function calls */
-       unsigned stmnt;         /* statement if type=EX_STMNT */
        unsigned op;            /* operator if type= EX_OP  */
       }
     opval;
@@ -91,6 +91,7 @@ typedef struct ast
        unsigned literalFromCast;       /* true if this is an EX_VALUE of LITERAL 
                                         * type resulting from a typecast.
                                         */
+       int argreg;                     /* argreg number when operand type == EX_OPERAND */
       }
     values;
 
@@ -100,7 +101,6 @@ typedef struct ast
     sym_link *ftype;           /* start of type chain for this subtree */
     sym_link *etype;           /* end of type chain for this subtree   */
 
-    symbol *argSym;            /* argument symbols            */
     struct ast *left;          /* pointer to left tree        */
     struct ast *right;         /* pointer to right tree       */
     symbol *trueLabel;         /* if statement trueLabel */
@@ -143,6 +143,8 @@ ast;
 #define AST_VALUE(x)            (x->opval.val)
 #define AST_VALUES(x,y)        (x->values.y)
 #define AST_FOR(x,y) x->values.forVals.y
+#define AST_ARGREG(x) x->values.argreg
+
 #define  IS_AST_PARAM(x)       (IS_AST_OP(x) && x->opval.op == PARAM)
 
 #define  CAN_EVAL(x)   (     x ==  '[' || x == '.' || x == PTR_OP ||   \
@@ -176,11 +178,11 @@ extern struct memmap *GcurMemmap;
 ast *newAst_VALUE (value * val);
 ast *newAst_OP (unsigned op);
 ast *newAst_LINK (sym_link * val);
-ast *newAst_STMNT (unsigned val);
 
 void initAst ();
 ast *newNode (long, ast *, ast *);
 ast *copyAst (ast *);
+ast *removeIncDecOps (ast *);
 value *sizeofOp (sym_link *);
 value *evalStmnt (ast *);
 ast *createFunction (symbol *, ast *);
@@ -188,7 +190,6 @@ ast *createBlock (symbol *, ast *);
 ast *createLabel (symbol *, ast *);
 ast *createCase (ast *, ast *, ast *);
 ast *createDefault (ast *, ast *);
-ast *optimizeCompare (ast *);
 ast *forLoopOptForm (ast *);
 ast *argAst (ast *);
 ast *resolveSymbols (ast *);
@@ -199,10 +200,15 @@ ast *createDo (symbol *, symbol *, symbol *, ast *, ast *);
 ast *createFor (symbol *, symbol *, symbol *, symbol *, ast *, ast *, ast *, ast *);
 void eval2icode (ast *);
 value *constExprValue (ast *, int);
+bool constExprTree (ast *);
+int setAstLineno (ast *, int);
 symbol *funcOfType (char *, sym_link *, sym_link *, int, int);
+symbol * funcOfTypeVarg (char *, char * , int , char **);
 ast *initAggregates (symbol *, initList *, ast *);
 bool hasSEFcalls (ast *);
 void addSymToBlock (symbol *, ast *);
+void freeStringSymbol(symbol *);
+DEFSETFUNC(resetParmKey);
 
 // exported variables 
 extern set *operKeyReset;