if (SPEC_SCLS(tree->left->etype) == S_IDATA)
DCL_TYPE(p) = IPOINTER ;
else
- DCL_TYPE(p) = POINTER ;
+ if (SPEC_SCLS(tree->left->etype) == S_FLASH)
+ DCL_TYPE(p) = FLPOINTER ;
+ else
+ DCL_TYPE(p) = POINTER ;
if (IS_AST_SYM_VALUE(tree->left)) {
AST_SYMBOL(tree->left)->addrtaken = 1;
if (SPEC_SCLS(expr->left->etype) == S_IDATA)
DCL_TYPE(val->type) = IPOINTER ;
else
- DCL_TYPE(val->type) = POINTER ;
+ if (SPEC_SCLS(expr->left->etype) == S_FLASH)
+ DCL_TYPE(val->type) = FLPOINTER ;
+ else
+ DCL_TYPE(val->type) = POINTER ;
val->type->next = expr->left->ftype;
val->etype = getSpec(val->type);
return val;
ptype->next = type;
/* if the output class is generic */
- if (SPEC_OCLS(etype) == generic)
- DCL_TYPE(ptype) = GPOINTER;
- else
- if (SPEC_OCLS(etype)->codesp ) {
- DCL_TYPE(ptype) = CPOINTER ;
- DCL_PTR_CONST(ptype) = 1;
- }
- else
- if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged)
- DCL_TYPE(ptype) = FPOINTER ;
- else
- if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged)
- DCL_TYPE(ptype) = PPOINTER ;
- else
- if (SPEC_OCLS(etype) == idata)
- DCL_TYPE(ptype) = IPOINTER;
- else
- DCL_TYPE(ptype) = POINTER ;
+ if ((DCL_TYPE(ptype) = PTR_TYPE(SPEC_OCLS(etype))) == CPOINTER)
+ DCL_PTR_CONST(ptype) = 1;
+
+/* if (SPEC_OCLS(etype) == generic) */
+/* DCL_TYPE(ptype) = GPOINTER; */
+/* else */
+/* if (SPEC_OCLS(etype)->codesp ) { */
+/* DCL_TYPE(ptype) = CPOINTER ; */
+/* DCL_PTR_CONST(ptype) = 1; */
+/* } */
+/* else */
+/* if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged) */
+/* DCL_TYPE(ptype) = FPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged) */
+/* DCL_TYPE(ptype) = PPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(etype) == idata) */
+/* DCL_TYPE(ptype) = IPOINTER; */
+/* else */
+/* DCL_TYPE(ptype) = POINTER ; */
/* if the variable was declared a constant */
/* then the pointer points to a constant */
link *optype = operandType(op);
link *opetype = getSpec(optype);
- /* set the pointer depending on the storage class */
- if (SPEC_OCLS(opetype)->codesp ) {
- DCL_TYPE(optype) = CPOINTER ;
+ if ((DCL_TYPE(optype) = PTR_TYPE(SPEC_OCLS(opetype))) == CPOINTER)
DCL_PTR_CONST(optype) = 1;
- }
- else
- if (SPEC_OCLS(opetype)->fmap && !SPEC_OCLS(opetype)->paged)
- DCL_TYPE(optype) = FPOINTER ;
- else
- if (SPEC_OCLS(opetype)->fmap && SPEC_OCLS(opetype)->paged)
- DCL_TYPE(optype) = PPOINTER ;
- else
- if (SPEC_OCLS(opetype) == idata)
- DCL_TYPE(optype) = IPOINTER;
- else
- DCL_TYPE(optype) = POINTER ;
+
+ /* set the pointer depending on the storage class */
+/* if (SPEC_OCLS(opetype)->codesp ) { */
+/* DCL_TYPE(optype) = CPOINTER ; */
+/* DCL_PTR_CONST(optype) = 1; */
+/* } */
+/* else */
+/* if (SPEC_OCLS(opetype)->fmap && !SPEC_OCLS(opetype)->paged) */
+/* DCL_TYPE(optype) = FPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(opetype)->fmap && SPEC_OCLS(opetype)->paged) */
+/* DCL_TYPE(optype) = PPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(opetype) == idata) */
+/* DCL_TYPE(optype) = IPOINTER; */
+/* else */
+/* DCL_TYPE(optype) = POINTER ; */
/* if the variable was declared a constant */
/* then the pointer points to a constant */
p = newLink();
p->class = DECLARATOR ;
- /* set the pointer depending on the storage class */
- if (SPEC_OCLS(opetype)->codesp ) {
- DCL_TYPE(p) = CPOINTER ;
+
+ if ((DCL_TYPE(p) = PTR_TYPE(SPEC_OCLS(opetype))) == CPOINTER)
DCL_PTR_CONST(p) = 1;
- }
- else
- if (SPEC_OCLS(opetype)->fmap && !SPEC_OCLS(opetype)->paged)
- DCL_TYPE(p) = FPOINTER ;
- else
- if (SPEC_OCLS(opetype)->fmap && SPEC_OCLS(opetype)->paged)
- DCL_TYPE(p) = PPOINTER ;
- else
- if (SPEC_OCLS(opetype) == idata)
- DCL_TYPE(p) = IPOINTER;
- else
- if (SPEC_OCLS(opetype) == data ||
- SPEC_OCLS(opetype) == overlay)
- DCL_TYPE(p) = POINTER ;
- else
- DCL_TYPE(p) = GPOINTER;
+
+ /* set the pointer depending on the storage class */
+/* if (SPEC_OCLS(opetype)->codesp ) { */
+/* DCL_TYPE(p) = CPOINTER ; */
+/* DCL_PTR_CONST(p) = 1; */
+/* } */
+/* else */
+/* if (SPEC_OCLS(opetype)->fmap && !SPEC_OCLS(opetype)->paged) */
+/* DCL_TYPE(p) = FPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(opetype)->fmap && SPEC_OCLS(opetype)->paged) */
+/* DCL_TYPE(p) = PPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(opetype) == idata) */
+/* DCL_TYPE(p) = IPOINTER; */
+/* else */
+/* if (SPEC_OCLS(opetype) == data || */
+/* SPEC_OCLS(opetype) == overlay) */
+/* DCL_TYPE(p) = POINTER ; */
+/* else */
+/* DCL_TYPE(p) = GPOINTER; */
/* make sure we preserve the const & volatile */
if (IS_CONSTANT(opetype))
DEBUG-NAME - 'A'
POINTER-TYPE - FPOINTER
*/
- xstack = allocMap (0, 1, 1, 0, 0, 0, options.xstack_loc, XSTACK_NAME,'A',FPOINTER);
+ xstack = allocMap (0, 1, 1, 0, 0, 0, options.xstack_loc, XSTACK_NAME,'A',PPOINTER);
/* internal stack segment ;
SFRSPACE - NO
#define IN_DIRSPACE(map) (map && map->direct)
#define IN_PAGEDSPACE(map) (map && map->paged )
#define IN_CODESPACE(map) (map && map->codesp)
+#define PTR_TYPE(map) (map ? (map->ptrType ? map->ptrType : POINTER)\
+ : GPOINTER)
/* forward decls for functions */
memmap *allocMap (char,char,char,char,char,char,unsigned, const char *,char,int );
DCL_PTR_CONST(ptr) = 1;
DCL_TYPE(ptr) = CPOINTER ;
break;
+ case S_FLASH:
+ DCL_TYPE(ptr) = FLPOINTER;
+ break;
default:
DCL_TYPE(ptr) = GPOINTER;
break;
case PPOINTER:
case POINTER:
return ( PTRSIZE ) ;
+ case FLPOINTER:
case FPOINTER:
case CPOINTER:
return ( FPTRSIZE );
- case GPOINTER:
+ case GPOINTER:
return ( GPTRSIZE );
default :
case PPOINTER:
case POINTER:
return ( PTRSIZE * 8) ;
+ case FLPOINTER:
case FPOINTER:
case CPOINTER:
return ( FPTRSIZE * 8);
case S_XDATA:
DCL_TYPE(val->type) = FPOINTER;
break;
+ case S_FLASH:
+ DCL_TYPE(val->type) = FLPOINTER;
+ break;
default :
DCL_TYPE(val->type) = GPOINTER;
}
if (DCL_PTR_CONST(type))
fprintf(of,"const ");
break;
+ case FLPOINTER:
+ fprintf (of,"_flash * ");
+ if (DCL_PTR_CONST(type))
+ fprintf(of,"const ");
+ break;
+
case POINTER:
fprintf (of,"_near * ");
if (DCL_PTR_CONST(type))
case PPOINTER:
fprintf (of,"DP,");
break;
+ case FLPOINTER:
+ fprintf (of,"DA,");
+ break;
case ARRAY :
fprintf (of,"DA%d,",DCL_ELEM(type));
break;
DCL_TYPE(x) == GPOINTER || \
DCL_TYPE(x) == IPOINTER || \
DCL_TYPE(x) == PPOINTER || \
+ DCL_TYPE(x) == FLPOINTER || \
DCL_TYPE(x) == CPOINTER || \
DCL_TYPE(x) == UPOINTER ))
#define IS_PTR_CONST(x) (IS_PTR(x) && DCL_PTR_CONST(x))
sprintf(val->name,"(%s + %d)",buffer,
(int)AST_LIT_VALUE(arrExpr->right)*size);
- val->type = newLink();
+ val->type = newLink();
if (SPEC_SCLS(arrExpr->left->etype) == S_CODE) {
DCL_TYPE(val->type) = CPOINTER ;
DCL_PTR_CONST(val->type) = 1;
if (SPEC_SCLS(arrExpr->left->etype) == S_IDATA)
DCL_TYPE(val->type) = IPOINTER ;
else
- DCL_TYPE(val->type) = POINTER ;
+ if (SPEC_SCLS(arrExpr->left->etype) == S_FLASH)
+ DCL_TYPE(val->type) = FLPOINTER ;
+ else
+ DCL_TYPE(val->type) = POINTER ;
val->type->next = arrExpr->left->ftype;
val->etype = getSpec(val->type);
return val;
if (SPEC_SCLS(structT->etype) == S_IDATA)
DCL_TYPE(val->type) = IPOINTER ;
else
- DCL_TYPE(val->type) = POINTER ;
+ if (SPEC_SCLS(structT->etype) == S_FLASH)
+ DCL_TYPE(val->type) = FLPOINTER ;
+ else
+ DCL_TYPE(val->type) = POINTER ;
val->type->next = sym->type;
val->etype = getSpec(val->type);
return val;
static int pointerCode (link *etype)
{
int p_type;
- if (SPEC_OCLS(etype)->codesp ) {
- p_type = CPOINTER ;
- }
- else
- if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged)
- p_type = FPOINTER ;
- else
- if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged)
- p_type = PPOINTER;
- else
- if (SPEC_OCLS(etype) == idata )
- p_type = IPOINTER;
- else
- p_type = POINTER ;
- return p_type;
+
+ return PTR_TYPE(SPEC_OCLS(etype));
+
+/* if (SPEC_OCLS(etype)->codesp ) { */
+/* p_type = CPOINTER ; */
+/* } */
+/* else */
+/* if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged) */
+/* p_type = FPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged) */
+/* p_type = PPOINTER; */
+/* else */
+/* if (SPEC_OCLS(etype) == idata ) */
+/* p_type = IPOINTER; */
+/* else */
+/* p_type = POINTER ; */
+/* return p_type; */
}
/*-----------------------------------------------------------------*/
if (IS_PTR(type) && !IS_FUNC(type->next))
p_type = DCL_TYPE(type);
else {
-
/* we have to go by the storage class */
- if (SPEC_OCLS(etype)->codesp ) {
- p_type = CPOINTER ;
- }
- else
- if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged)
- p_type = FPOINTER ;
- else
- if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged)
- p_type = PPOINTER;
- else
- if (SPEC_OCLS(etype) == idata )
- p_type = IPOINTER;
- else
- p_type = POINTER ;
+ p_type = PTR_TYPE(SPEC_OCLS(etype));
+
+/* if (SPEC_OCLS(etype)->codesp ) { */
+/* p_type = CPOINTER ; */
+/* } */
+/* else */
+/* if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged) */
+/* p_type = FPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged) */
+/* p_type = PPOINTER; */
+/* else */
+/* if (SPEC_OCLS(etype) == idata ) */
+/* p_type = IPOINTER; */
+/* else */
+/* p_type = POINTER ; */
}
/* now that we have the pointer type we assign
p_type = DCL_TYPE(type);
}
else {
-
/* we have to go by the storage class */
- if (SPEC_OCLS(etype)->codesp ) {
- p_type = CPOINTER ;
- }
- else
- if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged)
- p_type = FPOINTER ;
- else
- if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged)
- p_type = PPOINTER ;
- else
- if (SPEC_OCLS(etype) == idata )
- p_type = IPOINTER ;
- else
- p_type = POINTER ;
+ p_type = PTR_TYPE(SPEC_OCLS(etype));
+
+/* if (SPEC_OCLS(etype)->codesp ) { */
+/* p_type = CPOINTER ; */
+/* } */
+/* else */
+/* if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged) */
+/* p_type = FPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged) */
+/* p_type = PPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(etype) == idata ) */
+/* p_type = IPOINTER ; */
+/* else */
+/* p_type = POINTER ; */
}
/* now that we have the pointer type we assign
/* pointer to generic pointer */
if (IS_GENPTR(ctype)) {
- char *l = zero;
-
- if (IS_PTR(type))
- p_type = DCL_TYPE(type);
- else {
- /* we have to go by the storage class */
- if (SPEC_OCLS(etype)->codesp )
- p_type = CPOINTER ;
- else
- if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged)
- p_type = FPOINTER ;
- else
- if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged)
- p_type = PPOINTER;
- else
- if (SPEC_OCLS(etype) == idata )
- p_type = IPOINTER ;
- else
- p_type = POINTER ;
- }
+ char *l = zero;
+
+ if (IS_PTR(type))
+ p_type = DCL_TYPE(type);
+ else {
+ /* we have to go by the storage class */
+ p_type = PTR_TYPE(SPEC_OCLS(etype));
+
+/* if (SPEC_OCLS(etype)->codesp ) */
+/* p_type = CPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(etype)->fmap && !SPEC_OCLS(etype)->paged) */
+/* p_type = FPOINTER ; */
+/* else */
+/* if (SPEC_OCLS(etype)->fmap && SPEC_OCLS(etype)->paged) */
+/* p_type = PPOINTER; */
+/* else */
+/* if (SPEC_OCLS(etype) == idata ) */
+/* p_type = IPOINTER ; */
+/* else */
+/* p_type = POINTER ; */
+ }
- /* the first two bytes are known */
- size = GPTRSIZE - 1;
- offset = 0 ;
- while (size--) {
- aopPut(AOP(result),
- aopGet(AOP(right),offset,FALSE,FALSE),
- offset);
- offset++;
- }
- /* the last byte depending on type */
- switch (p_type) {
- case IPOINTER:
- case POINTER:
- l = zero;
- break;
- case FPOINTER:
- l = one;
- break;
- case CPOINTER:
- l = "#0x02";
- break;
- case PPOINTER:
- l = "#0x03";
- break;
-
- default:
- /* this should never happen */
- werror(E_INTERNAL_ERROR,__FILE__,__LINE__,
- "got unknown pointer type");
- exit(1);
- }
- aopPut(AOP(result),l, GPTRSIZE - 1);
- goto release ;
+ /* the first two bytes are known */
+ size = GPTRSIZE - 1;
+ offset = 0 ;
+ while (size--) {
+ aopPut(AOP(result),
+ aopGet(AOP(right),offset,FALSE,FALSE),
+ offset);
+ offset++;
+ }
+ /* the last byte depending on type */
+ switch (p_type) {
+ case IPOINTER:
+ case POINTER:
+ l = zero;
+ break;
+ case FPOINTER:
+ l = one;
+ break;
+ case CPOINTER:
+ l = "#0x02";
+ break;
+ case PPOINTER:
+ l = "#0x03";
+ break;
+
+ default:
+ /* this should never happen */
+ werror(E_INTERNAL_ERROR,__FILE__,__LINE__,
+ "got unknown pointer type");
+ exit(1);
+ }
+ aopPut(AOP(result),l, GPTRSIZE - 1);
+ goto release ;
}
/* just copy the pointers */