+2003-04-28 Scott Dattalo <scott@DATTALO.COM>
+
+ * src/pic/pCodepeep.c non-wildcard asmops are now handled
+ * src/pic/peeph.def Added two rules to optimize carry manipulation
+ * src/pic/* removed debug printfs
+
2003-04-28 Bernhard Held <bernhard@bernhardheld.de>
* debugger/mcs51/cmd.c: added header newalloc.h
static int udata_flag=0;
//dump_map(); /* display the register map */
- fprintf(stdout,";dump_sfr \n");
+ //fprintf(stdout,";dump_sfr \n");
if (pic->maxRAMaddress < 0) {
fprintf(stderr, "missing \"#pragma maxram\" setting\n");
return;
do {
- fprintf(stdout,"mapping %s to address 0x%02x, reg size = %d\n",reg->name, (reg->address+alias+i),reg->size);
+ //fprintf(stdout,"mapping %s to address 0x%02x, reg size = %d\n",reg->name, (reg->address+alias+i),reg->size);
finalMapping[reg->address + alias + i].reg = reg;
finalMapping[reg->address + alias + i].instance = i;
} while (alias>=0);
}
- fprintf(stderr,"%s - %s addr = 0x%03x, size %d\n",__FUNCTION__,reg->name, reg->address,reg->size);
+ //fprintf(stderr,"%s - %s addr = 0x%03x, size %d\n",__FUNCTION__,reg->name, reg->address,reg->size);
reg->isMapped = 1;
{
int i;
- fprintf(stderr,"%s - %s start_address = 0x%03x\n",__FUNCTION__,reg->name, start_address);
+ //fprintf(stderr,"%s - %s start_address = 0x%03x\n",__FUNCTION__,reg->name, start_address);
if(reg->isFixed) {
if (validAddress(reg->address,reg->size)) {
for (reg = setFirstItem(regset) ; reg ;
reg = setNextItem(regset)) {
- fprintf(stdout,"assigning %s isFixed=%d, wasUsed=%d\n",reg->name,reg->isFixed,reg->wasUsed);
+ //fprintf(stdout,"assigning %s isFixed=%d, wasUsed=%d\n",reg->name,reg->isFixed,reg->wasUsed);
if((!reg->isFixed) && ( used || reg->wasUsed))
address = assignRegister(reg,address);
for (sym = setFirstItem (map->syms); sym;
sym = setNextItem (map->syms)) {
- printf("%s\n",sym->name);
+ //printf("%s\n",sym->name);
/* if extern then add it into the extern list */
if (IS_EXTERN (sym->etype)) {
if(!pb)
return 0;
- fprintf(stderr, "%s\n",__FUNCTION__);
+ //fprintf(stderr, "%s\n",__FUNCTION__);
if (!s)
{
if(!peepBlock->target.wildpCodeOps[index]) {
peepBlock->target.wildpCodeOps[index] = PCI(pcs)->pcop;
- //if(PCI(pcs)->pcop->type == PO_GPR_TEMP)
+ //fprintf(stderr, "first time for wild opcode #%d\n",index);
+ return 1;
} else {
/*
pcs->print(stderr,pcs);
pcd->print(stderr,pcd);
-
fprintf(stderr, "comparing operands of these instructions, result %d\n",
pCodeOpCompare(PCI(pcs)->pcop, peepBlock->target.wildpCodeOps[index])
);
}
} else if (PCI(pcd)->pcop->type == PO_LITERAL) {
+ /*
+ pcs->print(stderr,pcs);
+ pcd->print(stderr,pcd);
+
+ fprintf(stderr, "comparing literal operands of these instructions, result %d\n",
+ pCodeOpCompare(PCI(pcs)->pcop, PCI(pcd)->pcop));
+ */
return pCodeOpCompare(PCI(pcs)->pcop, PCI(pcd)->pcop);
+ } else {
+ /* FIXME - need an else to check the case when the destination
+ * isn't a wild card */
+ /*
+ fprintf(stderr, "Destination is not wild: operand compare =%d\n",
+ pCodeOpCompare(PCI(pcs)->pcop, PCI(pcd)->pcop));
+ */
+ return pCodeOpCompare(PCI(pcs)->pcop, PCI(pcd)->pcop);
+
}
- /* FIXME - need an else to check the case when the destination
- * isn't a wild card */
} else
/* The pcd has no operand. Lines match if pcs has no operand either*/
return (PCI(pcs)->pcop == NULL);
if(!pcin && pct) {
DFPRINTF((stderr," partial match... no more code\n"));
- fprintf(stderr," partial match... no more code\n");
matched = 0;
}
if(!pct) {
SAFE_snprintf(ppbuff,&size, ";%d", debug_code);
pCode2str(*ppbuff, size, pc);
pCodeInsertBefore(pc, newpCodeCharP(buff1));
- fprintf(stderr,"removing instruction:\n%s\n",buff1);
+ //fprintf(stderr,"removing instruction:\n%s\n",buff1);
}
pc->destruct(pc);
pc->print(stderr,pc);
fprintf(stderr,"reg %s, type =%d\n",r->name, r->type);
}
- fprintf(stderr," removing reg %s because it is used only once\n",reg->name);
+ //fprintf(stderr," removing reg %s because it is used only once\n",reg->name);
Remove1pcode(pc, reg, 1);
/*
unlinkpCode(pc);
if(!reg)
return;
- fprintf(stderr,"%s\n",__FUNCTION__);
+ //fprintf(stderr,"%s\n",__FUNCTION__);
if(pc1)
Remove1pcode(pc1, reg, debug_code++);
; peep 12 - Removed redundant move
comf %1,f
}
+
+replace restart {
+ clrf %1
+ rlf %1,f
+ movlw 0x01
+ xorwf %1,f
+ movf %1,w
+ btfss STATUS,2
+ goto %2
+
+} by {
+ ; peep 13 - Optimized carry sequence
+ clrf %1
+ incf %1,F
+ btfss status,C
+ goto %2
+ clrf %1
+
+}
+
+replace restart {
+ clrf %1
+ rlf %1,f
+ movlw 0x01
+ xorwf %1,f
+ movf %1,w
+ btfsc STATUS,2
+ goto %2
+
+} by {
+ ; peep 13a - Optimized carry sequence
+ clrf %1
+ incf %1,F
+ btfsc status,C
+ goto %2
+ clrf %1
+
+}
*buffer = 's';
dReg->name = Safe_strdup(buffer);
}
- fprintf(stderr,"newReg: %s, rIdx = 0x%02x\n",dReg->name,rIdx);
+ //fprintf(stderr,"newReg: %s, rIdx = 0x%02x\n",dReg->name,rIdx);
dReg->isFree = 0;
dReg->wasUsed = 1;
if(type == REG_SFR)
breg = regset->item;
breg->isBitField = 1;
- fprintf(stderr,"bit reg: %s\n",breg->name);
+ //fprintf(stderr,"bit reg: %s\n",breg->name);
if(breg->isFixed) {
- fprintf(stderr,"packing bit at fixed address = 0x%03x\n",breg->address);
+ //fprintf(stderr,"packing bit at fixed address = 0x%03x\n",breg->address);
bitfield = typeRegWithIdx (breg->address >> 3, -1 , 1);
breg->rIdx = breg->address & 7;
if(!bitfield) {
sprintf (buffer, "fbitfield%02x", breg->address);
- fprintf(stderr,"new bit field\n");
+ //fprintf(stderr,"new bit field\n");
bitfield = newReg(REG_SFR, PO_GPR_BIT,breg->address,buffer,1,0);
bitfield->isBitField = 1;
bitfield->isFixed = 1;
byte_no++;
bit_no=0;
sprintf (buffer, "bitfield%d", byte_no);
- fprintf(stderr,"new relocatable bit field\n");
+ //fprintf(stderr,"new relocatable bit field\n");
relocbitfield = newReg(REG_GPR, PO_GPR_BIT,rDirectIdx++,buffer,1,0);
relocbitfield->isBitField = 1;
//addSet(&dynDirectRegs,relocbitfield);
breg->rIdx & 0x0007);
else {
- fprintf(stderr, "bit field is not assigned to a register\n");
+ //fprintf(stderr, "bit field is not assigned to a register\n");
fprintf (of, "%s\tEQU\t( (bitfield%d<<3)+%d)\n",
breg->name,
bit_no>>3,
packBits(dynDirectBitRegs);
assignFixedRegisters(dynAllocRegs);
- printf("assignFixedRegisters(dynAllocRegs);\n");
assignFixedRegisters(dynStackRegs);
- printf("assignFixedRegisters(dynStackRegs);\n");
assignFixedRegisters(dynDirectRegs);
- printf("assignFixedRegisters(dynDirectRegs);\n");
assignRelocatableRegisters(dynInternalRegs,0);
- printf("assignRelocatableRegisters(dynInternalRegs,0);\n");
assignRelocatableRegisters(dynAllocRegs,0);
- printf("assignRelocatableRegisters(dynAllocRegs,0);\n");
assignRelocatableRegisters(dynStackRegs,0);
- printf("assignRelocatableRegisters(dynStackRegs,0);\n");
+
/*
assignRelocatableRegisters(dynDirectRegs,0);
printf("assignRelocatableRegisters(dynDirectRegs,0);\n");