if (IS_ITEMP(op1) &&
!IS_ITEMP(op2) &&
sym1->isspilt &&
- (sym1->usl.spillLoc == sym2))
+ (SYM_SPIL_LOC(sym1) == sym2))
return TRUE;
if (IS_ITEMP(op2) &&
!IS_ITEMP(op1) &&
sym2->isspilt &&
sym1->level > 0 &&
- (sym2->usl.spillLoc == sym1))
+ (SYM_SPIL_LOC(sym2) == sym1))
return TRUE ;
return FALSE ;
aop->size = getSize(sym->type);
for ( i = 0 ; i < 1 ; i++ ) {
aop->aopu.aop_str[i] = accUse[i];
-// aop->aopu.pcop = pic16_popRegFromString("WREG", aop->size, sym->usl.spillLoc->offset);
+// aop->aopu.pcop = pic16_popRegFromString("WREG", aop->size, SYM_SPIL_LOC(sym)->offset);
}
fprintf(stderr, "%s:%d allocating AOP_ACC for sym= %s\n", __FILE__, __LINE__, sym->name);
DEBUGpic16_emitcode(";","%d size=%d",__LINE__,aop->size);
if (sym->ruonly) {
/*
sym->aop = op->aop = aop = newAsmop(AOP_PCODE);
- aop->aopu.pcop = pic16_popGetImmd(sym->usl.spillLoc->rname,0,sym->usl.spillLoc->offset);
+ aop->aopu.pcop = pic16_popGetImmd(SYM_SPIL_LOC(sym)->rname,0,SYM_SPIL_LOC(sym)->offset);
//pic16_allocDirReg (IC_LEFT(ic));
aop->size = getSize(sym->type);
*/
}
#endif
/* else spill location */
- if (sym->usl.spillLoc && getSize(sym->type) != getSize(sym->usl.spillLoc->type)) {
+ if (SYM_SPIL_LOC(sym) && getSize(sym->type) != getSize(SYM_SPIL_LOC(sym)->type)) {
/* force a new aop if sizes differ */
- sym->usl.spillLoc->aop = NULL;
+ SYM_SPIL_LOC(sym)->aop = NULL;
}
#if 0
DEBUGpic16_emitcode(";","%s %d %s sym->rname = %s, offset %d",
__FUNCTION__,__LINE__,
- sym->usl.spillLoc->rname,
- sym->rname, sym->usl.spillLoc->offset);
+ SYM_SPIL_LOC(sym)->rname,
+ sym->rname, SYM_SPIL_LOC(sym)->offset);
#endif
- //aop->aopu.pcop = pic16_popGetImmd(sym->usl.spillLoc->rname,0,sym->usl.spillLoc->offset);
- if (sym->usl.spillLoc && sym->usl.spillLoc->rname) {
+ //aop->aopu.pcop = pic16_popGetImmd(SYM_SPIL_LOC(sym)->rname,0,SYM_SPIL_LOC(sym)->offset);
+ if (SYM_SPIL_LOC(sym) && SYM_SPIL_LOC(sym)->rname) {
sym->aop = op->aop = aop = newAsmop(AOP_PCODE);
- aop->aopu.pcop = pic16_popRegFromString(sym->usl.spillLoc->rname,
+ aop->aopu.pcop = pic16_popRegFromString(SYM_SPIL_LOC(sym)->rname,
getSize(sym->type),
- sym->usl.spillLoc->offset, op);
+ SYM_SPIL_LOC(sym)->offset, op);
} else if (getSize(sym->type) <= 1) {
//fprintf (stderr, "%s:%d called for a spillLocation -- assigning WREG instead --- CHECK (size:%u)!\n", __FUNCTION__, __LINE__, getSize(sym->type));
pic16_emitpcomment (";!!! %s:%d called for a spillLocation -- assigning WREG instead --- CHECK", __FUNCTION__, __LINE__);
p_type = DCL_TYPE(operandType(ptr));
switch (p_type) {
- case FPOINTER:
case POINTER:
+ case FPOINTER:
+ case IPOINTER:
+ case PPOINTER:
if (!fsr0_setup || !*fsr0_setup)
{
pic16_loadFSR0( ptr, 0 );
}
break;
+ case CPOINTER:
+ /* XXX: Writing to CPOINTERs not (yet) implemented. */
+ assert ( !doWrite && "Cannot write into __code space!" );
+ if( (AOP_TYPE(ptr) == AOP_PCODE)
+ && ((AOP(ptr)->aopu.pcop->type == PO_IMMEDIATE)
+ || (AOP(ptr)->aopu.pcop->type == PO_DIR)))
+ {
+ pic16_emitpcode(POC_MOVLW, pic16_popGet (AOP (ptr), 0));
+ pic16_emitpcode(POC_MOVWF, pic16_popCopyReg (&pic16_pc_tblptrl));
+ pic16_emitpcode(POC_MOVLW, pic16_popGet (AOP (ptr), 1));
+ pic16_emitpcode(POC_MOVWF, pic16_popCopyReg (&pic16_pc_tblptrh));
+ pic16_emitpcode(POC_MOVLW, pic16_popGet (AOP (ptr), 2));
+ pic16_emitpcode(POC_MOVWF, pic16_popCopyReg (&pic16_pc_tblptru));
+ } else {
+ mov2fp(pic16_popCopyReg(&pic16_pc_tblptrl), AOP(ptr), 0);
+ mov2fp(pic16_popCopyReg(&pic16_pc_tblptrh), AOP(ptr), 1);
+ mov2fp(pic16_popCopyReg(&pic16_pc_tblptru), AOP(ptr), 2);
+ } // if
+
+ pic16_emitpcodeNULLop (POC_TBLRD_POSTINC);
+ pic16_emitpcode (POC_MOVFW, pic16_popCopyReg (&pic16_pc_tablat));
+ break;
+
default:
assert (0 && "invalid pointer type specified");
break;
pic16_aopOp(result,ic,TRUE);
size = AOP_SIZE(result);
+ /* if bit then unpack */
+ if (IS_BITFIELD(getSpec (operandType (left)))) {
+ genUnpackBits(result,left,"BAD",GPOINTER);
+ goto release;
+ } // if
+
DEBUGpic16_pic16_AopType(__LINE__,left,NULL,result);
DEBUGpic16_emitcode ("; "," %d getting const pointer",__LINE__);
offset++;
}
+release:
pic16_freeAsmop(left,NULL,ic,TRUE);
pic16_freeAsmop(result,NULL,ic,TRUE);
}
case POINTER:
case FPOINTER:
case IPOINTER:
- genNearPointerGet (left,result,ic);
- break;
-
-#if 0
- /* MUST move them somewhere; handle [PF]POINTERs like POINTERS or like GPOINTERs?!? */
case PPOINTER:
- genPagedPointerGet(left,result,ic);
- break;
-
- case FPOINTER:
- genFarPointerGet (left,result,ic);
+ genNearPointerGet (left,result,ic);
break;
-#endif
case CPOINTER:
genConstPointerGet (left,result,ic);
case POINTER:
case FPOINTER:
case IPOINTER:
- genNearPointerSet (right,result,ic);
- break;
-
-#if 0
- /* MUST move them somewhere; handle [PF]POINTERs like POINTERS or like GPOINTERs?!? */
case PPOINTER:
- genPagedPointerSet (right,result,ic);
- break;
-
- case FPOINTER:
- genFarPointerSet (right,result,ic);
+ genNearPointerSet (right,result,ic);
break;
-#endif
case GPOINTER:
genGenPointerSet (right,result,ic);
&& !IS_ITEMP(right)) {
DEBUGpic16_emitcode("; ", "%s:%d symbol in code space, take special care\n", __FUNCTION__, __LINE__);
- fprintf(stderr, "%s:%d symbol %s = [ %s ] is in code space\n", __FILE__, __LINE__, OP_SYMBOL(result)->name, OP_SYMBOL(right)->name);
+ //fprintf(stderr, "%s:%d symbol %s = [ %s ] is in code space\n", __FILE__, __LINE__, OP_SYMBOL(result)->name, OP_SYMBOL(right)->name);
// set up table pointer
if(pic16_isLitOp(right)) {
/* pointer to generic pointer */
if (IS_GENPTR(ctype)) {
- char *l = zero;
if (IS_PTR(type))
p_type = DCL_TYPE(type);
}
/* the last byte depending on type */
switch (p_type) {
- case IPOINTER:
case POINTER:
case FPOINTER:
+ case IPOINTER:
+ case PPOINTER:
pic16_movLit2f(pic16_popGet(AOP(result), GPTRSIZE-1), GPTR_TAG_DATA);
break;
pic16_emitpcode(POC_MOVFF, pic16_popGet2(AOP(right), AOP(result), GPTRSIZE-1));
break;
- case PPOINTER:
- pic16_emitcode(";BUG!? ","%d",__LINE__);
- l = "#0x03";
- break;
-
case GPOINTER:
if (GPTRSIZE > AOP_SIZE(right)) {
// assume __data pointer... THIS MIGHT BE WRONG!