* device/lib/libsdcc.lib,
[fw/sdcc] / src / pic / pcode.h
index 09a697b7bce56e5655c55b4bd0e7349c6773a739..d90eb86cd531048fb537ee8b6e1484a1c46533c2 100644 (file)
 //#include "ralloc.h"
 struct regs;
 
+/* When changing these, you must also update the assembler template
+ * in device/lib/libsdcc/macros.inc */
+#define GPTRTAG_DATA   0x00
+#define GPTRTAG_CODE   0x80
+
 /*
    Post code generation
 
@@ -242,6 +247,7 @@ typedef enum
        PC_WILD,        /* wildcard - an opcode place holder used 
                         * in the pCode peep hole optimizer */
        PC_CSOURCE,     /* C-Source Line  */
+       PC_ASMDIR,      /* Assembler directive */
        PC_BAD          /* Mark the pCode object as being bad */
 } PC_TYPE;
 
@@ -429,6 +435,7 @@ typedef struct pCodeComment
 
 } pCodeComment;
 
+
 /*************************************************
     pCodeComment
 **************************************************/
@@ -490,6 +497,7 @@ typedef struct pCodeFlow
 
 } pCodeFlow;
 
+
 /*************************************************
   pCodeFlowLink
 
@@ -511,6 +519,7 @@ typedef struct pCodeFlowLink
 
 } pCodeFlowLink;
 
+
 /*************************************************
     pCodeInstruction
 
@@ -550,6 +559,19 @@ typedef struct pCodeInstruction
 } pCodeInstruction;
 
 
+/*************************************************
+    pCodeAsmDir
+**************************************************/
+
+typedef struct pCodeAsmDir
+{
+  pCodeInstruction pci;
+  
+  char *directive;
+  char *arg;
+} pCodeAsmDir;
+
+
 /*************************************************
     pCodeLabel
 **************************************************/
@@ -564,6 +586,7 @@ typedef struct pCodeLabel
 
 } pCodeLabel;
 
+
 /*************************************************
     pCodeFunction
 **************************************************/
@@ -762,6 +785,7 @@ typedef struct peepCommand {
 #define PCFLINK(x)((pCodeFlowLink *)(x))
 #define PCW(x)    ((pCodeWild *)(x))
 #define PCCS(x)   ((pCodeCSource *)(x))
+#define PCAD(x)          ((pCodeAsmDir *)(x))
 
 #define PCOP(x)   ((pCodeOp *)(x))
 //#define PCOB(x)   ((pCodeOpBit *)(x))
@@ -790,6 +814,7 @@ typedef struct peepCommand {
 #define isPCL(x)        ((PCODE(x)->type == PC_LABEL))
 #define isPCW(x)        ((PCODE(x)->type == PC_WILD))
 #define isPCCS(x)       ((PCODE(x)->type == PC_CSOURCE))
+#define isPCASMDIR(x)  ((PCODE(x)->type == PC_ASMDIR))
 
 /*
   macros for checking pCodeInstruction types
@@ -812,7 +837,7 @@ pCode *newpCodeCharP(char *cP);              // Create a new pCode given a char
 pCode *newpCodeInlineP(char *cP);            // Create a new pCode given a char *
 pCode *newpCodeFunction(char *g, char *f,int); // Create a new function
 pCode *newpCodeLabel(char *name,int key);    // Create a new label given a key
-pCode *newpCodeCSource(int ln, char *f, char *l); // Create a new symbol line 
+pCode *newpCodeCSource(int ln, char *f, const char *l); // Create a new symbol line 
 pCode *findNextInstruction(pCode *pci);
 pCode *findNextpCode(pCode *pc, PC_TYPE pct);
 pCode *pCodeInstructionCopy(pCodeInstruction *pci,int invert);
@@ -833,6 +858,8 @@ void pCodeInsertAfter(pCode *pc1, pCode *pc2);
 void pCodeInsertBefore(pCode *pc1, pCode *pc2);
 void pCodeDeleteChain(pCode *f,pCode *t);
 
+pCode *newpCodeAsmDir(char *asdir, char *argfmt, ...); 
+
 pCodeOp *newpCodeOpLabel(char *name, int key);
 pCodeOp *newpCodeOpImmd(char *name, int offset, int index, int code_space,int is_func);
 pCodeOp *newpCodeOpLit(int lit);
@@ -846,6 +873,8 @@ int isPCinFlow(pCode *pc, pCode *pcflow);
 struct regs * getRegFromInstruction(pCode *pc);
 
 extern void pcode_test(void);
+void resetpCodeStatistics (void);
+void dumppCodeStatistics (FILE *of);
 
 /*-----------------------------------------------------------------*
  * pCode objects.