what you give them. Help stamp out software-hoarding!
-------------------------------------------------------------------------*/
-#include "common.h"
-#include "ralloc.h"
#include "device.h"
-#include "pcode.h"
#include "gen.h"
+#include "ralloc.h"
+
+
+set *dynAllocRegs=NULL;
+set *dynStackRegs=NULL;
+set *dynProcessorRegs=NULL;
+set *dynDirectRegs=NULL;
+set *dynDirectBitRegs=NULL;
+set *dynInternalRegs=NULL;
#define FENTRY2 1 ? (void)0 : printf
/* since the pack the registers depending strictly on the MCU */
/*-----------------------------------------------------------------*/
-extern void genpic14Code (iCode *);
-extern void pic14_assignConfigWordValue(int address, int value);
-
/* Global data */
static struct
{
}
_G;
-/* Shared with gen.c */
-int pic14_ptrRegReq; /* one byte pointer register required */
-
-
-set *dynAllocRegs=NULL;
-set *dynStackRegs=NULL;
-set *dynProcessorRegs=NULL;
-set *dynDirectRegs=NULL;
-set *dynDirectBitRegs=NULL;
-set *dynInternalRegs=NULL;
+static int pic14_ptrRegReq; /* one byte pointer register required */
static hTab *dynDirectRegNames= NULL;
// static hTab *regHash = NULL; /* a hash table containing ALL registers */
static int dynrIdx = 0x1000;
-int pic14_nRegs = 128; // = sizeof (regspic14) / sizeof (regs);
-
int Gstack_base_addr=0; /* The starting address of registers that
* are used to pass and return parameters */
-int Gstack_size = 0;
-
+static int Gstack_size = 0;
-
-
-static void spillThis (symbol *);
static int debug = 0; // should be 0 when committed, creates .d files
static FILE *debugF = NULL;
+
/*-----------------------------------------------------------------*/
/* debugLog - open a file for debugging information */
/*-----------------------------------------------------------------*/
-//static void debugLog(char *inst,char *fmt, ...)
static void
debugLog (char *fmt,...)
{
debugF = NULL;
}
}
-#define AOP(op) op->aop
static char *
debugAopGet (char *str, operand * op)
}
-static regs *regWithIdx (set *dRegs, int idx, int fixed);
+/*-----------------------------------------------------------------*/
+/* regWithIdx - Search through a set of registers that matches idx */
+/*-----------------------------------------------------------------*/
+static regs *
+regWithIdx (set *dRegs, int idx, int fixed)
+{
+ regs *dReg;
+
+ for (dReg = setFirstItem(dRegs) ; dReg ;
+ dReg = setNextItem(dRegs)) {
+
+ if(idx == dReg->rIdx && (fixed == (int)dReg->isFixed)) {
+ while (dReg->reg_alias) dReg = dReg->reg_alias;
+ return dReg;
+ }
+ }
+
+ return NULL;
+}
+
/*-----------------------------------------------------------------*/
/* newReg - allocate and init memory for a new register */
/*-----------------------------------------------------------------*/
return dReg;
}
-/*-----------------------------------------------------------------*/
-/* regWithIdx - Search through a set of registers that matches idx */
-/*-----------------------------------------------------------------*/
-static regs *
-regWithIdx (set *dRegs, int idx, int fixed)
-{
- regs *dReg;
-
- for (dReg = setFirstItem(dRegs) ; dReg ;
- dReg = setNextItem(dRegs)) {
-
- if(idx == dReg->rIdx && (fixed == (int)dReg->isFixed)) {
- while (dReg->reg_alias) dReg = dReg->reg_alias;
- return dReg;
- }
- }
-
- return NULL;
-}
-
/*-----------------------------------------------------------------*/
/* regWithName - Search through a set of registers that matches name */
/*-----------------------------------------------------------------*/
return NULL; // name wasn't found in the hash table
}
-int IS_CONFIG_ADDRESS(int address)
-{
-
- return ((address == 0x2007) || (address == 0x2008));
-}
-
/*-----------------------------------------------------------------*/
/* allocNewDirReg - allocates a new register of given type */
/*-----------------------------------------------------------------*/
return nFreeRegs (type);
}
-void writeSetUsedRegs(FILE *of, set *dRegs)
+#if 0
+static void writeSetUsedRegs(FILE *of, set *dRegs)
{
regs *dReg;
}
}
-extern void dump_map(void);
+#endif
-void packBits(set *bregs)
+static void packBits(set *bregs)
{
set *regset;
regs *breg;
-void bitEQUs(FILE *of, set *bregs)
+static void bitEQUs(FILE *of, set *bregs)
{
regs *breg,*bytereg;
int bit_no=0;
}
-void aliasEQUs(FILE *of, set *fregs, int use_rIdx)
+#if 0
+static void aliasEQUs(FILE *of, set *fregs, int use_rIdx)
{
regs *reg;
for (reg = setFirstItem(fregs) ; reg ;
reg = setNextItem(fregs)) {
- //if(!reg->isEmitted && reg->wasUsed) {
if(reg->wasUsed) {
if(use_rIdx)
fprintf (of, "%s\tEQU\t0x%03x\n",
}
}
+#endif
void writeUsedRegs(FILE *of)
{
packBits(dynDirectBitRegs);
- //dump_map();
-
bitEQUs(of,dynDirectBitRegs);
}
}
}
+
+#if 0
+static
DEFSETFUNC (markRegFree)
{
((regs *)item)->isFree = 1;
return 0;
}
+static
DEFSETFUNC (deallocReg)
{
fprintf(stderr,"deallocting register %s\n",((regs *)item)->name);
return 0;
}
+
/*-----------------------------------------------------------------*/
/* freeAllRegs - mark all registers as free */
/*-----------------------------------------------------------------*/
-void
+static void
pic14_freeAllRegs ()
{
// int i;
/*-----------------------------------------------------------------*/
/*-----------------------------------------------------------------*/
-void
+static void
pic14_deallocateAllRegs ()
{
// int i;
}
*/
}
+#endif
/*-----------------------------------------------------------------*/
hTabDeleteItem (&iCodehTab, dic->key, dic, DELETE_ITEM, NULL);
}
-void printSymType(char * str, sym_link *sl)
+static void printSymType(char * str, sym_link *sl)
{
if (debug) {
debugLog (" %s Symbol type: ",str);
* the function checkSClass in src/SDCCsymt.c dinks with
* the S_TYPE in ways the PIC port doesn't fully like...*/
/*-----------------------------------------------------------------*/
-void isData(sym_link *sl)
+static void isData(sym_link *sl)
{
FILE *of = stderr;