rlen -= 8;
/* if we are done */
- if ( rlen <= 0 )
+ if ( rlen < 8 )
break ;
aopPut(AOP(result),"a",offset++);
}
if (rlen) {
- emitcode("anl","a,#0x%02x",((unsigned char)-1)>>(-rlen));
+ emitcode("anl","a,#0x%02x",((unsigned char)-1)>>(rlen));
aopPut(AOP(result),"a",offset);
}
asmop *aop = NULL;
regs *preg = NULL ;
char *rname ;
- link *rtype, *retype;
+ link *rtype, *retype, *letype;
link *ltype = operandType(left);
char buffer[80];
rtype = operandType(result);
retype= getSpec(rtype);
-
+ letype= getSpec(ltype);
+
aopOp(left,ic,FALSE, FALSE);
/* if left is rematerialisable and
lower 128 bytes of space */
if (AOP_TYPE(left) == AOP_IMMD &&
!IS_BITVAR(retype) &&
+ !IS_BITVAR(letype) &&
DCL_TYPE(ltype) == POINTER) {
genDataPointerGet (left,result,ic);
return ;
aopOp (result,ic,FALSE, FALSE);
/* if bitfield then unpack the bits */
- if (IS_BITVAR(retype))
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
genUnpackBits (result,rname,POINTER);
else {
/* we have can just get the values */
{
asmop *aop = NULL;
regs *preg = NULL ;
- char *rname ;
- link *rtype, *retype;
+ char *rname;
+ link *rtype, *retype, *letype;
rtype = operandType(result);
retype= getSpec(rtype);
-
+ letype= getSpec(operandType(left));
aopOp(left,ic,FALSE, FALSE);
/* if the value is already in a pointer register
aopOp (result,ic,FALSE, FALSE);
/* if bitfield then unpack the bits */
- if (IS_BITVAR(retype))
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
genUnpackBits (result,rname,PPOINTER);
else {
/* we have can just get the values */
{
int size, offset ;
link *retype = getSpec(operandType(result));
-
+ link *letype = getSpec(operandType(left));
D(emitcode(";", "genFarPointerGet"););
aopOp(left,ic,FALSE, FALSE);
aopOp(result,ic,FALSE, TRUE);
/* if bit then unpack */
- if (IS_BITVAR(retype))
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
genUnpackBits(result,"dptr",FPOINTER);
else {
size = AOP_SIZE(result);
{
int size, offset ;
link *retype = getSpec(operandType(result));
+ link *letype = getSpec(operandType(left));
aopOp(left,ic,FALSE, TRUE);
aopOp(result,ic,FALSE, TRUE);
/* if bit then unpack */
- if (IS_BITVAR(retype))
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
genUnpackBits(result,"dptr",GPOINTER);
else {
size = AOP_SIZE(result);
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 ; */
}
/* now that we have the pointer type we assign
l = aopGet(AOP(right),offset++,FALSE,TRUE,FALSE);
rLen -= 8 ;
- if (rLen <= 0 )
+ if (rLen < 8 )
break ;
switch (p_type) {
break;
}
- emitcode ("anl","a,#0x%02x",((unsigned char)-1 << -rLen) );
+ emitcode ("anl","a,#0x%02x",((unsigned char)-1 << rLen) );
emitcode ("orl","a,b");
}
asmop *aop = NULL;
regs *preg = NULL ;
char *rname , *l;
- link *retype;
+ link *retype, *letype;
link *ptype = operandType(result);
retype= getSpec(operandType(right));
+ letype= getSpec(ptype);
aopOp(result,ic,FALSE, FALSE);
in data space & not a bit variable */
if (AOP_TYPE(result) == AOP_IMMD &&
DCL_TYPE(ptype) == POINTER &&
- !IS_BITVAR(retype)) {
+ !IS_BITVAR(retype) &&
+ !IS_BITVAR(letype)) {
genDataPointerSet (right,result,ic);
return;
}
aopOp (right,ic,FALSE, FALSE);
/* if bitfield then unpack the bits */
- if (IS_BITVAR(retype))
- genPackBits (retype,right,rname,POINTER);
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
+ genPackBits ((IS_BITVAR(retype) ? retype : letype),right,rname,POINTER);
else {
/* we have can just get the values */
int size = AOP_SIZE(right);
asmop *aop = NULL;
regs *preg = NULL ;
char *rname , *l;
- link *retype;
+ link *retype, *letype;
retype= getSpec(operandType(right));
+ letype= getSpec(operandType(result));
aopOp(result,ic,FALSE, FALSE);
aopOp (right,ic,FALSE, FALSE);
/* if bitfield then unpack the bits */
- if (IS_BITVAR(retype))
- genPackBits (retype,right,rname,PPOINTER);
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
+ genPackBits ((IS_BITVAR(retype) ? retype : letype) ,right,rname,PPOINTER);
else {
/* we have can just get the values */
int size = AOP_SIZE(right);
{
int size, offset ;
link *retype = getSpec(operandType(right));
+ link *letype = getSpec(operandType(result));
aopOp(result,ic,FALSE, FALSE);
aopOp(right,ic,FALSE, TRUE);
/* if bit then unpack */
- if (IS_BITVAR(retype))
- genPackBits(retype,right,"dptr",FPOINTER);
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
+ genPackBits((IS_BITVAR(retype)?retype:letype),right,"dptr",FPOINTER);
else {
size = AOP_SIZE(right);
offset = 0 ;
{
int size, offset ;
link *retype = getSpec(operandType(right));
+ link *letype = getSpec(operandType(result));
aopOp(result,ic,FALSE, TRUE);
aopOp(right,ic,FALSE, TRUE);
/* if bit then unpack */
- if (IS_BITVAR(retype))
- genPackBits(retype,right,"dptr",GPOINTER);
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
+ genPackBits((IS_BITVAR(retype)?retype:letype),right,"dptr",GPOINTER);
else {
size = AOP_SIZE(right);
offset = 0 ;
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 ; */
}
/* now that we have the pointer type we assign
if (IS_RENT(sym->etype) || options.stackAuto) {
if (options.useXstack) {
- /* set up the PAGE for the xternal stack */
- if (sym->args) {
- emitcode("push","dph");
- emitcode("push","acc");
- }
- emitcode("mov","dph,__page_no__");
- emitcode("movx","a,@dptr");
- if (sym->args) {
- emitcode("pop","acc");
- emitcode("pop","dph");
- }
emitcode("mov","r0,%s",spname);
emitcode("mov","a,_bp");
emitcode("movx","@r0,a");
int rlen = 0 ;
link *etype;
int offset = 0 ;
+ int rsize ;
etype = getSpec(operandType(result));
-
+ rsize = getSize(operandType(result));
/* read the first byte */
switch (ptype) {
break;
}
+ rlen = SPEC_BLEN(etype) ;
+
/* if we have bitdisplacement then it fits */
/* into this byte completely or if length is */
/* less than a byte */
emitcode("anl","a,#0x%02x",
((unsigned char) -1)>>(8 - SPEC_BLEN(etype)));
- aopPut(AOP(result),"a",offset);
- return ;
+ aopPut(AOP(result),"a",offset++);
+ goto finish;
}
/* bit field did not fit in a byte */
- rlen = SPEC_BLEN(etype) - 8;
aopPut(AOP(result),"a",offset++);
while (1) {
rlen -= 8;
/* if we are done */
- if ( rlen <= 0 )
+ if ( rlen < 8 )
break ;
aopPut(AOP(result),"a",offset++);
}
if (rlen) {
- emitcode("anl","a,#0x%02x",((unsigned char)-1)>>(-rlen));
- aopPut(AOP(result),"a",offset);
+ // emitcode("anl","a,#0x%02x",((unsigned char)-1)>>(rlen));
+ AccLsh(8-rlen);
+ aopPut(AOP(result),"a",offset++);
}
+ finish:
+ if (offset < rsize) {
+ rsize -= offset;
+ while (rsize--) aopPut(AOP(result),zero,offset++);
+ }
return ;
}
l = aopGet(AOP(right),offset++,FALSE,TRUE);
rLen -= 8 ;
- if (rLen <= 0 )
+ if (rLen < 8 )
break ;
switch (p_type) {
break;
}
- emitcode ("anl","a,#0x%02x",((unsigned char)-1 << -rLen) );
+ emitcode ("anl","a,#0x%02x",(((unsigned char)-1 << rLen) & 0xff) );
emitcode ("orl","a,b");
}
asmop *aop = NULL;
regs *preg = NULL ;
char *rname , *l;
- link *retype;
+ link *retype, *letype;
link *ptype = operandType(result);
retype= getSpec(operandType(right));
-
+ letype= getSpec(ptype);
aopOp(result,ic,FALSE);
/* if the result is rematerializable &
in data space & not a bit variable */
if (AOP_TYPE(result) == AOP_IMMD &&
DCL_TYPE(ptype) == POINTER &&
- !IS_BITVAR(retype)) {
+ !IS_BITVAR(retype) &&
+ !IS_BITVAR(letype)) {
genDataPointerSet (right,result,ic);
return;
}
aopOp (right,ic,FALSE);
/* if bitfield then unpack the bits */
- if (IS_BITVAR(retype))
- genPackBits (retype,right,rname,POINTER);
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
+ genPackBits ((IS_BITVAR(retype) ? retype : letype),right,rname,POINTER);
else {
/* we have can just get the values */
int size = AOP_SIZE(right);
asmop *aop = NULL;
regs *preg = NULL ;
char *rname , *l;
- link *retype;
+ link *retype, *letype;
retype= getSpec(operandType(right));
+ letype= getSpec(operandType(result));
aopOp(result,ic,FALSE);
aopOp (right,ic,FALSE);
/* if bitfield then unpack the bits */
- if (IS_BITVAR(retype))
- genPackBits (retype,right,rname,PPOINTER);
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
+ genPackBits ((IS_BITVAR(retype) ? retype : letype),right,rname,PPOINTER);
else {
/* we have can just get the values */
int size = AOP_SIZE(right);
{
int size, offset ;
link *retype = getSpec(operandType(right));
-
+ link *letype = getSpec(operandType(result));
aopOp(result,ic,FALSE);
/* if the operand is already in dptr
aopOp(right,ic,FALSE);
/* if bit then unpack */
- if (IS_BITVAR(retype))
- genPackBits(retype,right,"dptr",FPOINTER);
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
+ genPackBits((IS_BITVAR(retype) ? retype : letype),right,"dptr",FPOINTER);
else {
size = AOP_SIZE(right);
offset = 0 ;
{
int size, offset ;
link *retype = getSpec(operandType(right));
+ link *letype = getSpec(operandType(result));
aopOp(result,ic,FALSE);
aopOp(right,ic,FALSE);
/* if bit then unpack */
- if (IS_BITVAR(retype))
- genPackBits(retype,right,"dptr",GPOINTER);
+ if (IS_BITVAR(retype) || IS_BITVAR(letype))
+ genPackBits((IS_BITVAR(retype) ? retype : letype),right,"dptr",GPOINTER);
else {
size = AOP_SIZE(right);
offset = 0 ;
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 ; */
}
/* now that we have the pointer type we assign