-------------------------------------------------------------------------*/
-#include "ralloc.h"
+//#include "ralloc.h"
+struct regs;
/*
Post code generation
#ifndef __PCODE_H__
#define __PCODE_H__
+/***********************************************************************
+ * debug stuff
+ *
+ * The DFPRINTF macro will call fprintf if PCODE_DEBUG is defined.
+ * The macro is used like:
+ *
+ * DPRINTF(("%s #%d\n","test", 1));
+ *
+ * The double parenthesis (()) are necessary
+ *
+ ***********************************************************************/
+//#define PCODE_DEBUG
+
+#ifdef PCODE_DEBUG
+#define DFPRINTF(args) (fprintf args)
+#else
+#define DFPRINTF(args) ;
+#endif
+
+
/***********************************************************************
* PIC status bits - this will move into device dependent headers
***********************************************************************/
PO_FSR, // The "file select register" (in 18c it's one of three)
PO_INDF, // The Indirect register
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_SFR_REGISTER, // A special function register (e.g. PORTA)
+ PO_PCL, // Program counter Low register
+ PO_PCLATH, // Program counter Latch high register
PO_LITERAL, // A constant
PO_IMMEDIATE, // (8051 legacy)
PO_DIR, // Direct memory (8051 legacy)
#define PCC_Z (1<<2)
#define PCC_DC (1<<3)
#define PCC_W (1<<4)
+#define PCC_EXAMINE_PCOP (1<<5)
/***********************************************************************
*
POC_BTFSS,
POC_CALL,
POC_COMF,
+ POC_COMFW,
POC_CLRF,
POC_CLRW,
POC_DECF,
POC_NEGF,
POC_RETLW,
POC_RETURN,
+ POC_RLF,
+ POC_RLFW,
+ POC_RRF,
+ POC_RRFW,
POC_SUBLW,
POC_SUBWF,
POC_SUBFW,
+ POC_SWAPF,
+ POC_SWAPFW,
POC_TRIS,
POC_XORLW,
POC_XORWF,
{
pCodeOp pcop; // Can be either GPR or SFR
int rIdx; // Index into the register table
- regs *r;
+ struct regs *r;
struct pBlock *pb;
} pCodeOpReg;
+typedef struct pCodeOpRegBit
+{
+ pCodeOpReg pcor; // The Register containing this bit
+ int bit; // 0-7 bit number.
+ PIC_OPTYPE subtype; // The type of this register.
+} pCodeOpRegBit;
/*************************************************
PIC_OPCODE op; // The opcode of the instruction.
- char *mnemonic; // Pointer to mnemonic string
+ char const * const mnemonic; // Pointer to mnemonic string
pCodeOp *pcop; // Operand
int nvars; // Number of wildcard registers in target.
char **vars; // array of pointers to them
+ int nops; // Number of wildcard operands in target.
+ pCodeOp **wildpCodeOps; // array of pointers to the pCodeOp's.
+
int nwildpCodes; // Number of wildcard pCodes in target/replace
- pCode **wildpCodes; // array of pointers to the pCodeOp's.
+ pCode **wildpCodes; // array of pointers to the pCode's.
/* (Note: a wildcard register is a place holder. Any register
#define PCOL(x) ((pCodeOpLit *)(x))
#define PCOLAB(x) ((pCodeOpLabel *)(x))
#define PCOR(x) ((pCodeOpReg *)(x))
+#define PCORB(x) ((pCodeOpRegBit *)(x))
#define PCOW(x) ((pCodeOpWild *)(x))
#define PBR(x) ((pBranch *)(x))
pCodeOp *newpCodeOpLabel(int key);
pCodeOp *newpCodeOpLit(int lit);
-pCodeOp *newpCodeOpBit(char *name, int bit);
+pCodeOp *newpCodeOpBit(char *name, int bit,int inBitSpace);
pCodeOp *newpCodeOp(char *name, PIC_OPTYPE p);
extern void pcode_test(void);
* pCode objects.
*-----------------------------------------------------------------*/
-extern pCodeOp pc_status;
-extern pCodeOp pc_indf;
-extern pCodeOp pc_fsr;
+extern pCodeOpReg pc_status;
+extern pCodeOpReg pc_indf;
+extern pCodeOpReg pc_fsr;
+extern pCodeOpReg pc_pcl;
+extern pCodeOpReg pc_pclath;
+extern pCodeOpReg pc_kzero;
//////////////////// DELETE THIS ///////////////////