extern char *pic16_aopGet (struct asmop *aop, int offset, bool bit16, bool dname);
#if defined(__BORLANDC__) || defined(_MSC_VER)
-#define STRCASECMP stricmp
#define inline
-#else
-#define STRCASECMP strcasecmp
#endif
#define DUMP_DF_GRAPHS 0
/* pic16_newpCodeCSource - create a new pCode Source Symbol */
/*-----------------------------------------------------------------*/
-pCode *pic16_newpCodeCSource(int ln, char *f, char *l)
+pCode *pic16_newpCodeCSource(int ln, const char *f, const char *l)
{
pCodeCSource *pccs;
{
pCode *pc; pCodeLabel *pcl;
- if(!pb)
+ if(!pb || !pb->pcHead)
return;
for(pc = pb->pcHead; (pc=pic16_findNextInstruction(pc->next)) != NULL; ) {
defmap_t *map;
pCodeFlow *pcfl;
+ assert(pb);
+
pcfl = PCI(pic16_findNextInstruction (pb->pcHead))->pcflow;
/* find initial value (assigning pc == NULL) */
set *todo;
set *blacklist;
+ if (!pb) return;
+
/* initialize out_vals to unique'fied defmaps per pCodeFlow */
for (pc = pic16_findNextInstruction (pb->pcHead); pc; pc = pic16_findNextInstruction (pc->next)) {
if (isPCFL(pc)) {
static void pic16_destructDF (pBlock *pb) {
pCode *pc, *next;
+ if (!pb) return;
+
/* remove old defmaps */
pc = pic16_findNextInstruction (pb->pcHead);
while (pc) {
static int pic16_pBlockHasAsmdirs (pBlock *pb) {
pCode *pc;
+ if (!pb) return 0;
+
pc = pic16_findNextInstruction (pb->pcHead);
while (pc) {
if (isPCAD(pc)) return 1;
pCode *pc, *next;
int change=0;
+ if (!pb) return;
+
//fprintf (stderr, "creating DF for pb %p (%s)\n", pb, pic16_pBlockGetFunctionName (pb));
pic16_destructDF (pb);
static void pic16_vcg_dump (FILE *of, pBlock *pb) {
pCode *pc;
+ if (!pb) return;
+
/* check pBlock: do not analyze pBlocks with ASMDIRs (for now...) */
if (pic16_pBlockHasAsmdirs (pb)) {
//fprintf (stderr, "%s: pBlock contains ASMDIRs -- data flow analysis not performed!\n", __FUNCTION__);
char buf[BUF_SIZE];
pCode *pc;
+ if (!pb) return;
+
/* get function name */
pc = pb->pcHead;
while (pc && !isPCF(pc)) pc = pc->next;