pCodeOp *popCopyGPR2Bit(pCodeOp *pc, int bitval);
void pCodeRegMapLiveRanges(pBlock *pb);
+pBranch * pBranchAppend(pBranch *h, pBranch *n);
+
/****************************************************************/
/* PIC Instructions */
/* */
/*-----------------------------------------------------------------*/
-int mnem2key(char const *mnem)
+int mnem2key(unsigned char const *mnem)
{
int key = 0;
if(asdir && *asdir) {
- while(isspace(*asdir))asdir++; // strip any white space from the beginning
+ while(isspace((unsigned char)*asdir))asdir++; // strip any white space from the beginning
pcad->directive = Safe_strdup( asdir );
}
va_end(ap);
- while(isspace(*lbp))lbp++;
+ while(isspace((unsigned char)*lbp))lbp++;
if(lbp && *lbp)
pcad->arg = Safe_strdup( lbp );
pc->prev->next = pc->next;
if(pc->next)
pc->next->prev = pc->prev;
-
+
+#if 0
+ /* RN: I believe this should be right here, but this did not
+ * cure the bug I was hunting... */
+ /* must keep labels -- attach to following instruction */
+ if (isPCI(pc) && PCI(pc)->label && pc->next)
+ {
+ pCodeInstruction *pcnext = PCI(findNextInstruction (pc->next));
+ if (pcnext)
+ {
+ pBranchAppend (pcnext->label, PCI(pc)->label);
+ }
+ }
+#endif
pc->prev = pc->next = NULL;
}
}
SAFE_snprintf(&s,&size,";\t--FLOW change\n");
break;
case PC_CSOURCE:
- SAFE_snprintf(&s,&size,";#CSRC\t%s %d\n; %s\n", PCCS(pc)->file_name, PCCS(pc)->line_number, PCCS(pc)->line);
+// SAFE_snprintf(&s,&size,";#CSRC\t%s %d\n; %s\n", PCCS(pc)->file_name, PCCS(pc)->line_number, PCCS(pc)->line);
+ SAFE_snprintf(&s,&size,"%s\t.line\t%d; \"%s\"\t%s\n",(options.debug?"":";"),PCCS(pc)->line_number, PCCS(pc)->file_name, PCCS(pc)->line);
break;
case PC_ASMDIR:
if(PCAD(pc)->directive) {
break;
case PC_CSOURCE:
- fprintf(of,";#CSRC\t%s %d\n; %s\n", PCCS(pc)->file_name, PCCS(pc)->line_number, PCCS(pc)->line);
+// fprintf(of,";#CSRC\t%s %d\n; %s\n", PCCS(pc)->file_name, PCCS(pc)->line_number, PCCS(pc)->line);
+ fprintf(of,"%s\t.line\t%d; \"%s\"\t%s\n", (options.debug?"":";"), PCCS(pc)->line_number, PCCS(pc)->file_name, PCCS(pc)->line);
break;
case PC_ASMDIR:
}
}
+#if 1
if (LastRegIdx == reg->rIdx) // If this is the same register as last time then it is in same bank
return cur_bank;
LastRegIdx = reg->rIdx;
+#endif
if (reg->isFixed) {
bank = REG_BANK(reg);
if (isCALL(pc)) {
pCode *pcf = findFunction(get_op_from_instruction(PCI(pc)));
+ LastRegIdx = -1; /* do not know which register is touched in the called function... */
if (pcf && isPCF(pcf)) {
pCode *pcfr;
int rbank = 'U'; // Undetermined
if (isPCI(pcfr)) {
if ((PCI(pcfr)->op==POC_RETURN) || (PCI(pcfr)->op==POC_RETLW)) {
if (rbank == 'U')
- rbank = PCFL(pcfr)->lastBank;
+ rbank = PCI(pcfr)->pcflow->lastBank;
else
- if (rbank != PCFL(pcfr)->lastBank)
+ if (rbank != PCI(pcfr)->pcflow->lastBank)
return -1; // Unknown bank - multiple returns with different banks
}
}
/* Extern functions may use registers in different bank - must call banksel */
return -1; /* Unknown bank */
}
+ /* play safe... */
+ return -1;
}
if ((isPCI(pc)) && (PCI(pc)->op == POC_BANKSEL)) {
pBlockMergeLabels(pb);
AnalyzepBlock(pb);
} else {
- DFPRINTF((stderr," skipping block analysis dbName=%c blockname=%c\n",dbName,getpBlock_dbName));
+ DFPRINTF((stderr," skipping block analysis dbName=%c blockname=%c\n",dbName,getpBlock_dbName(pb)));
}
}