"pdata",
"reentrant",
"sfr",
+ "sfr16",
"using",
"_data",
"_code",
"_naked",
"shadowregs",
"wparam",
+ "prodlp",
+ "prodhp",
+ "fsr0lp",
+ "fixed16x16",
// "bit",
// "idata",
pic16_sectioninfo_t pic16_sectioninfo;
+int xinst=0;
+
extern char *pic16_processor_base_name(void);
/* for an unknowned reason. - EEP */
void pic16_emitDebuggerSymbol (char *);
-extern regs* newReg(short type, short pc_type, int rIdx, char *name, int size, int alias, operand *refop);
extern void pic16_emitConfigRegs(FILE *of);
extern void pic16_emitIDRegs(FILE *of);
}
static int
-_pic16_regparm (sym_link * l)
+_pic16_regparm (sym_link * l, bool reentrant)
{
/* force all parameters via SEND/RECEIVE */
if(0 /*pic16_options.ip_stack*/) {
stackLen = 64;
fprintf(stderr, "%s:%d: warning: setting stack to default size %d (0x%04x)\n",
filename, lineno-1, stackLen, stackLen);
-
-// fprintf(stderr, "%s:%d setting stack to default size %d\n", __FILE__, __LINE__, stackLen);
}
-// fprintf(stderr, "Initializing stack pointer at 0x%x len 0x%x\n", stackPos, stackLen);
-
/* check sanity of stack */
- if ((stackPos >> 8) != ((stackPos+stackLen) >> 8)) {
+ if ((stackPos >> 8) != ((stackPos+stackLen-1) >> 8)) {
fprintf (stderr, "%s:%u: warning: stack [0x%03X,0x%03X] crosses memory bank boundaries (not fully tested)\n",
filename,lineno-1, stackPos, stackPos+stackLen-1);
}
{ 0, OPTIMIZE_GOTO, NULL, "try to use (conditional) BRA instead of GOTO"},
{ 0, OPTIMIZE_CMP, NULL, "try to optimize some compares"},
{ 0, OPTIMIZE_DF, NULL, "thoroughly analyze data flow (memory and time intensive!)"},
+ { 0, "--num-func-alloc-regs", &pic16_options.CATregs, "dump number of temporary registers allocated for each function"},
+#if XINST
+ { 'y', "--extended", &xinst, "enable Extended Instruction Set/Literal Offset Addressing mode"},
+#endif
{ 0, NULL, NULL, NULL}
};
char *msprintf(hTab *pvals, const char *pformat, ...);
int my_system(const char *cmd);
+/* forward declarations */
+extern const char *pic16_linkCmd[];
+extern const char *pic16_asmCmd[];
+extern set *asmOptionsSet;
+
/* custom function to link objects */
static void _pic16_linkEdit(void)
{
hTab *linkValues=NULL;
- char lfrm[256];
+ char lfrm[1024];
char *lcmd;
- char temp[128];
+ char temp[1024];
set *tSet=NULL;
int ret;
* {linker} {incdirs} {lflags} -o {outfile} {spec_ofiles} {ofiles} {libs}
*
*/
-
- sprintf(lfrm, "{linker} {incdirs} {lflags} -o {outfile} {user_ofile} {spec_ofiles} {ofiles} {libs}");
-
- shash_add(&linkValues, "linker", "gplink");
+ sprintf(lfrm, "{linker} {incdirs} {lflags} -o {outfile} {user_ofile} {ofiles} {spec_ofiles} {libs}");
+
+ shash_add(&linkValues, "linker", pic16_linkCmd[0]);
mergeSets(&tSet, libDirsSet);
mergeSets(&tSet, libPathsSet);
}
-/* forward declarations */
-extern const char *pic16_linkCmd[];
-extern const char *pic16_asmCmd[];
-extern set *asmOptionsSet;
-
static void
_pic16_finaliseOptions (void)
{
pic16_options.ip_stack = 1; /* set to 1 to enable ipop/ipush for stack */
pic16_options.gstack = 0;
pic16_options.debgen = 0;
+ pic16_options.CATregs = 0;
}
static const char *
/* multiplication is fixed */
/* support mul for char/int/long */
if((ic->op == '*')
- && (getSize(OP_SYMBOL(IC_LEFT(ic))->type ) < 2))return TRUE;
+ && (IS_SYMOP(IC_LEFT(ic)))
+ && (getSize(OP_SYMBOL(IC_LEFT(ic))->type ) < 2))
+ return TRUE;
#endif
#if 0
/* support div for char/int/long */
- if((getSize(OP_SYMBOL(IC_LEFT(ic))->type ) < 0)
- && (ic->op == '/'))return TRUE;
+ if((ic->op == '/')
+ && (IS_SYMOP(IC_LEFT(ic)))
+ && (getSize(OP_SYMBOL(IC_LEFT(ic))->type ) < 0))
+ return TRUE;
#endif
return FALSE;