Beautified (indented) compiler source tree
[fw/sdcc] / src / SDCCicode.h
index c22e63d1c128458f82ba9580b7a55b3615d822d0..ca4142468909f2360c6d76b290d1a2eb437c619a 100644 (file)
 #ifndef SDCCICODE_H
 #define SDCCICODE_H 1
 
-extern symbol *returnLabel ;
-extern symbol *entryLabel  ;
-extern int iCodeKey ;
-extern int operandKey ;
-
-enum {
-       CONDITIONAL = 0 ,
-        EXPRESSION      ,
-        STATEMENT       ,
-        LEAF            };
-
-typedef enum {
-  SYMBOL    =1,
-  VALUE       ,
-  TYPE      
-} OPTYPE;
+extern symbol *returnLabel;
+extern symbol *entryLabel;
+extern int iCodeKey;
+extern int operandKey;
+
+enum
+  {
+    CONDITIONAL = 0,
+    EXPRESSION,
+    STATEMENT,
+    LEAF
+  };
+
+typedef enum
+  {
+    SYMBOL = 1,
+    VALUE,
+    TYPE
+  }
+OPTYPE;
 
 #define IS_SYMOP(op) (op && op->type == SYMBOL)
 #define ADDTOCHAIN(x) addSetHead(&iCodeChain,x)
@@ -70,30 +74,34 @@ typedef enum {
 #define OP_ISLIVE_FCALL(op) (IS_ITEMP(op) && OP_SYMBOL(op)->isLiveFcall)
 
 /* typedef for operand */
-typedef struct operand {
-    OPTYPE type;                /* type of operand */
-    unsigned int  isaddr : 1;    /* is an address   */
-    unsigned int  isvolatile: 1; /* is a volatile operand */
-    unsigned int  isGlobal :1 ;  /* is a global operand */
-    unsigned int  isPtr    :1 ;  /* is assigned a pointer */
-    unsigned int  isGptr   :1 ;  /* is a generic pointer  */
-    unsigned int  isParm   :1 ;  /* is a parameter        */
-    unsigned int  isLiteral:1 ;  /* operand is literal    */
-    unsigned int  noSpilLoc:1 ;  /* cannot be assigned a spil location */
-
-    unsigned key ;
-    int      parmBytes;
-    union {
-       struct symbol *symOperand ; /* operand is of type symbol */
-       struct value  *valOperand ; /* operand is of type value  */
-       struct sym_link *typeOperand; /* operand is of type typechain */
-    } operand ;
-    
-    bitVect *usesDefs;             /* which definitions are used by this */
-    struct  asmop *aop      ;      /* asm op for this operand */
-} operand ;
-
-/* definition for intermediate code */ 
+typedef struct operand
+  {
+    OPTYPE type;               /* type of operand */
+    unsigned int isaddr:1;     /* is an address   */
+    unsigned int isvolatile:1; /* is a volatile operand */
+    unsigned int isGlobal:1;   /* is a global operand */
+    unsigned int isPtr:1;      /* is assigned a pointer */
+    unsigned int isGptr:1;     /* is a generic pointer  */
+    unsigned int isParm:1;     /* is a parameter        */
+    unsigned int isLiteral:1;  /* operand is literal    */
+    unsigned int noSpilLoc:1;  /* cannot be assigned a spil location */
+
+    unsigned key;
+    int parmBytes;
+    union
+      {
+       struct symbol *symOperand;      /* operand is of type symbol */
+       struct value *valOperand;       /* operand is of type value  */
+       struct sym_link *typeOperand;   /* operand is of type typechain */
+      }
+    operand;
+
+    bitVect *usesDefs;         /* which definitions are used by this */
+    struct asmop *aop;         /* asm op for this operand */
+  }
+operand;
+
+/* definition for intermediate code */
 #define IC_RESULT(x) (x)->ulrrcnd.lrr.result
 #define IC_LEFT(x)   (x)->ulrrcnd.lrr.left
 #define IC_RIGHT(x)  (x)->ulrrcnd.lrr.right
@@ -106,68 +114,80 @@ typedef struct operand {
 #define IC_JTLABELS(x) (x)->ulrrcnd.jmpTab.labels
 #define IC_INLINE(x) (x)->inlineAsm
 
-typedef struct iCode 
-{
-    unsigned int op ;              /* operation defined */
-    int key ;                      /* running key for this iCode */
-    int seq ;                      /* sequence number within routine */
-    short depth ;                  /* loop depth of this iCode */
-    short level ;                  /* scope level */
-    short block ;                  /* sequential block number */
-    unsigned nosupdate:1;          /* don't update spillocation with this */
-    unsigned generated:1;          /* code generated for this one */   
-    unsigned parmPush :1;          /* parameter push Vs spill push */
-    unsigned supportRtn:1;         /* will cause a call to a support routine */
-    unsigned regsSaved:1 ;         /* registers have been saved */
-    unsigned bankSaved:1 ;         /* register bank has been saved */
-    
-    struct iCode *next ;           /* next in chain */
-    struct iCode *prev ;           /* previous in chain */
-    set          *movedFrom;       /* if this iCode gets moved to another block */
-    bitVect *rlive ;               /* ranges that are live at this point */
-    int    defKey  ;               /* key for the operand being defined  */
-    bitVect *uses  ;               /* vector of key of used symbols      */
-    bitVect *rUsed ;               /* registers used by this instruction */
-    bitVect *rMask ;               /* registers in use during this instruction */
-    union {
-       struct {
-           operand *left      ;           /* left if any   */
-           operand *right     ;           /* right if any  */
-           operand *result    ;           /* result of this op */
-       } lrr ;
-
-       struct {
-           operand *condition ;           /* if this is a conditional */
-           symbol  *trueLabel ;           /* true for conditional     */
-           symbol  *falseLabel;           /* false for conditional    */
-       } cnd;
-
-       struct {
-           operand *condition ;           /* condition for the jump */
-           set     *labels    ;           /* ordered set of labels  */
-       } jmpTab ;
-
-    } ulrrcnd;
-
-    union {
-       symbol  *label ;           /* for a goto statement     */
-       value   *args  ;
-    } argLabel ;
-    
-    char        *inlineAsm ;           /* pointer to inline assembler code */
-
-    int     lineno      ;           /* file & lineno for debug information */
-    char   *filename    ;         
-} iCode ;
+typedef struct iCode
+  {
+    unsigned int op;           /* operation defined */
+    int key;                   /* running key for this iCode */
+    int seq;                   /* sequence number within routine */
+    short depth;               /* loop depth of this iCode */
+    short level;               /* scope level */
+    short block;               /* sequential block number */
+    unsigned nosupdate:1;      /* don't update spillocation with this */
+    unsigned generated:1;      /* code generated for this one */
+    unsigned parmPush:1;       /* parameter push Vs spill push */
+    unsigned supportRtn:1;     /* will cause a call to a support routine */
+    unsigned regsSaved:1;      /* registers have been saved */
+    unsigned bankSaved:1;      /* register bank has been saved */
+
+    struct iCode *next;                /* next in chain */
+    struct iCode *prev;                /* previous in chain */
+    set *movedFrom;            /* if this iCode gets moved to another block */
+    bitVect *rlive;            /* ranges that are live at this point */
+    int defKey;                        /* key for the operand being defined  */
+    bitVect *uses;             /* vector of key of used symbols      */
+    bitVect *rUsed;            /* registers used by this instruction */
+    bitVect *rMask;            /* registers in use during this instruction */
+    union
+      {
+       struct
+         {
+           operand *left;      /* left if any   */
+           operand *right;     /* right if any  */
+           operand *result;    /* result of this op */
+         }
+       lrr;
+
+       struct
+         {
+           operand *condition; /* if this is a conditional */
+           symbol *trueLabel;  /* true for conditional     */
+           symbol *falseLabel; /* false for conditional    */
+         }
+       cnd;
+
+       struct
+         {
+           operand *condition; /* condition for the jump */
+           set *labels;        /* ordered set of labels  */
+         }
+       jmpTab;
+
+      }
+    ulrrcnd;
+
+    union
+      {
+       symbol *label;          /* for a goto statement     */
+       value *args;
+      }
+    argLabel;
+
+    char *inlineAsm;           /* pointer to inline assembler code */
+
+    int lineno;                        /* file & lineno for debug information */
+    char *filename;
+  }
+iCode;
 
 /* various functions associated to iCode */
-typedef struct icodeFuncTable 
-{
-    int icode ;
-    char *printName ;
-    void (*iCodePrint)(FILE *,iCode *,char *) ;
-    iCode * (*iCodeCopy)(iCode *) ;
-} iCodeTable ;
+typedef struct icodeFuncTable
+  {
+    int icode;
+    char *printName;
+    void (*iCodePrint) (FILE *, iCode *, char *);
+    iCode *(*iCodeCopy) (iCode *);
+  }
+iCodeTable;
 
 /* useful macros */
 #define SKIP_IC2(x)  (x->op == GOTO     ||     \
@@ -185,7 +205,7 @@ typedef struct icodeFuncTable
                       x->op == JUMPTABLE ||    \
                       x->op == RECEIVE  ||     \
                      SKIP_IC1(x)||  \
-                     x->op == SEND         ) 
+                     x->op == SEND         )
 
 #define IS_CONDITIONAL(x) (x->op == EQ_OP || \
                           x->op == '<'   || \
@@ -244,41 +264,41 @@ typedef struct icodeFuncTable
 /*-----------------------------------------------------------------*/
 /* forward references for functions                                */
 /*-----------------------------------------------------------------*/
-iCode   *reverseiCChain     (      );
-bool     isOperandOnStack   (operand *);
-int      isOperandVolatile  (operand *,bool);
-int      isOperandGlobal    (operand *);
-void     printiCChain    ( iCode * , FILE *);
-operand *ast2iCode          ( ast *);
-operand *geniCodeCast       ( sym_link *, operand *,bool);
+iCode *reverseiCChain ();
+bool isOperandOnStack (operand *);
+int isOperandVolatile (operand *, bool);
+int isOperandGlobal (operand *);
+void printiCChain (iCode *, FILE *);
+operand *ast2iCode (ast *);
+operand *geniCodeCast (sym_link *, operand *, bool);
 operand *geniCodePtrPtrSubtract (operand *, operand *);
-void     initiCode          ();
-iCode   *iCodeFromAst   ( ast * );
-int      isiCodeEqual   ( iCode *,iCode *) ;
-int      isOperandEqual ( operand *, operand *);
-iCodeTable *getTableEntry (int  );
-int      isOperandLiteral (operand *);
-operand *operandOperation (operand *,operand *,int,sym_link *);
-double   operandLitValue ( operand * );
+void initiCode ();
+iCode *iCodeFromAst (ast *);
+int isiCodeEqual (iCode *, iCode *);
+int isOperandEqual (operand *, operand *);
+iCodeTable *getTableEntry (int);
+int isOperandLiteral (operand *);
+operand *operandOperation (operand *, operand *, int, sym_link *);
+double operandLitValue (operand *);
 operand *operandFromLit (float);
-operand *operandFromOperand(operand *);
-int      isParameterToCall (value *,operand *);
-iCode   *newiCodeLabelGoto (int , symbol *);
-symbol  *newiTemp(char *);
-symbol  *newiTempLabel (char *);
-symbol  *newiTempPreheaderLabel ();
-iCode   *newiCode (int, operand *, operand *);
-sym_link *operandType(operand *);
+operand *operandFromOperand (operand *);
+int isParameterToCall (value *, operand *);
+iCode *newiCodeLabelGoto (int, symbol *);
+symbol *newiTemp (char *);
+symbol *newiTempLabel (char *);
+symbol *newiTempPreheaderLabel ();
+iCode *newiCode (int, operand *, operand *);
+sym_link *operandType (operand *);
 operand *operandFromValue (value *);
-operand *operandFromSymbol(symbol *);
-sym_link *aggrToPtr ( sym_link *, bool);
-int      piCode (void *, FILE * );
-int      printOperand (operand *,FILE *);
-void     setOperandType (operand *, sym_link *);
-bool     isOperandInFarSpace (operand *);
-operand *opFromOpWithDU (operand *,bitVect *,bitVect *);
-iCode   *copyiCode (iCode *);
-operand *newiTempFromOpoperand *);
+operand *operandFromSymbol (symbol *);
+sym_link *aggrToPtr (sym_link *, bool);
+int piCode (void *, FILE *);
+int printOperand (operand *, FILE *);
+void setOperandType (operand *, sym_link *);
+bool isOperandInFarSpace (operand *);
+operand *opFromOpWithDU (operand *, bitVect *, bitVect *);
+iCode *copyiCode (iCode *);
+operand *newiTempFromOp (operand *);
 /*-----------------------------------------------------------------*/
 /* declaration of exported variables                               */
 /*-----------------------------------------------------------------*/