(genPlus): added special handling for 256 byte aligned xdata arrays. Erik helped...
[fw/sdcc] / src / pic / pcode.h
index 7d896723a3c1b6f014be82f4f2e1cdc32e464092..1c3a024f7ee18b67f7a068c4dfe60b585ed9d5b9 100644 (file)
@@ -143,6 +143,7 @@ typedef enum
   PO_GPR_REGISTER,   // A general purpose register
   PO_GPR_BIT,        // A bit of a general purpose register
   PO_GPR_TEMP,       // A general purpose temporary register
+  PO_GPR_POINTER,    // A general purpose pointer
   PO_SFR_REGISTER,   // A special function register (e.g. PORTA)
   PO_PCL,            // Program counter Low register
   PO_PCLATH,         // Program counter Latch high register
@@ -185,6 +186,7 @@ typedef enum
   POC_COMFW,
   POC_CLRF,
   POC_CLRW,
+  POC_CLRWDT,
   POC_DECF,
   POC_DECFW,
   POC_DECFSZ,
@@ -310,9 +312,13 @@ typedef struct pCodeOpLit
 typedef struct pCodeOpImmd
 {
   pCodeOp pcop;
-  int offset;                   /* low,med, or high byte of immediat value */
-  int index;                    /* add this to the immediate value */
-  unsigned _const:1;           /* is in code space    */
+  int offset;           /* low,med, or high byte of immediate value */
+  int index;            /* add this to the immediate value */
+  unsigned _const:1;    /* is in code space    */
+  unsigned _function:1; /* is a (pointer to a) function */
+
+  int rIdx;             /* If this immd points to a register */
+  struct regs *r;       /* then this is the reg. */
 
 } pCodeOpImmd;
 
@@ -320,6 +326,7 @@ typedef struct pCodeOpLabel
 {
   pCodeOp pcop;
   int key;
+  int offset;           /* low or high byte of label */
 } pCodeOpLabel;
 
 typedef struct pCodeOpReg
@@ -341,6 +348,15 @@ typedef struct pCodeOpRegBit
 } pCodeOpRegBit;
 
 
+typedef struct pCodeOpRegPtr
+{
+  pCodeOpReg  pcor;       // The Register containing this bit
+
+  //  PIC_OPTYPE subtype;     // The type of this register.
+  //  unsigned int inBitSpace: 1; /* True if in bit space, else
+
+} pCodeOpRegPtr;
+
 typedef struct pCodeOpWild
 {
   pCodeOp pcop;
@@ -438,14 +454,17 @@ typedef struct pCodeFlow
   pCode *end;   /* Last pCode in this flow. Note that
                   the first pCode is pc.next */
 
-  set **uses;   /* map the pCode instruction inCond and outCond conditions 
+  /*  set **uses;   * map the pCode instruction inCond and outCond conditions 
                 * in this array of set's. The reason we allocate an 
                 * array of pointers instead of declaring each type of 
                 * usage is because there are port dependent usage definitions */
-  int nuses;    /* number of uses sets */
+  //int nuses;    /* number of uses sets */
 
   set *from;    /* flow blocks that can send control to this flow block */
   set *to;      /* flow blocks to which this one can send control */
+  struct pCodeFlow *ancestor; /* The most immediate "single" pCodeFlow object that
+                              * executes prior to this one. In many cases, this 
+                              * will be just the previous */
 
   int inCond;   /* Input conditions - stuff assumed defined at entry */
   int outCond;  /* Output conditions - stuff modified by flow block */
@@ -511,6 +530,7 @@ typedef struct pCodeInstruction
   unsigned int isBitInst: 1;   /* e.g. BCF */
   unsigned int isBranch:  1;   /* True if this is a branching instruction */
   unsigned int isSkip:    1;   /* True if this is a skip instruction */
+  unsigned int isLit:     1;   /* True if this instruction has an literal operand */
 
   PIC_OPCODE inverted_op;      /* Opcode of instruction that's the opposite of this one */
   unsigned int inCond;   // Input conditions for this instruction
@@ -727,6 +747,7 @@ typedef struct peepCommand {
 #define PCL(x)    ((pCodeLabel *)(x))
 #define PCF(x)    ((pCodeFunction *)(x))
 #define PCFL(x)   ((pCodeFlow *)(x))
+#define PCFLINK(x)((pCodeFlowLink *)(x))
 #define PCW(x)    ((pCodeWild *)(x))
 #define PCCS(x)   ((pCodeCSource *)(x))
 
@@ -750,6 +771,7 @@ typedef struct peepCommand {
 #define isPCI(x)        ((PCODE(x)->type == PC_OPCODE))
 #define isPCI_BRANCH(x) ((PCODE(x)->type == PC_OPCODE) &&  PCI(x)->isBranch)
 #define isPCI_SKIP(x)   ((PCODE(x)->type == PC_OPCODE) &&  PCI(x)->isSkip)
+#define isPCI_LIT(x)    ((PCODE(x)->type == PC_OPCODE) &&  PCI(x)->isLit)
 #define isPCI_BITSKIP(x)((PCODE(x)->type == PC_OPCODE) &&  PCI(x)->isSkip && PCI(x)->isBitInst)
 #define isPCFL(x)       ((PCODE(x)->type == PC_FLOW))
 #define isPCF(x)        ((PCODE(x)->type == PC_FUNCTION))
@@ -786,7 +808,7 @@ void pCodePeepInit(void);
 void pBlockConvert2ISR(pBlock *pb);
 
 pCodeOp *newpCodeOpLabel(char *name, int key);
-pCodeOp *newpCodeOpImmd(char *name, int offset, int index, int code_space);
+pCodeOp *newpCodeOpImmd(char *name, int offset, int index, int code_space,int is_func);
 pCodeOp *newpCodeOpLit(int lit);
 pCodeOp *newpCodeOpBit(char *name, int bit,int inBitSpace);
 pCodeOp *newpCodeOpRegFromStr(char *name);
@@ -811,8 +833,9 @@ extern pCodeOpReg pc_fsr;
 extern pCodeOpReg pc_pcl;
 extern pCodeOpReg pc_pclath;
 extern pCodeOpReg pc_kzero;
-extern pCodeOpReg pc_wsave;     /* wsave and ssave are used to save W and the Status */
+extern pCodeOpReg pc_wsave;     /* wsave, ssave and psave are used to save W, the Status and PCLATH*/
 extern pCodeOpReg pc_ssave;     /* registers during an interrupt */
+extern pCodeOpReg pc_psave;     /* registers during an interrupt */
 
 
 #endif // __PCODE_H__