git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1514
4a8a32a2-be11-0410-ad9d-
d568d2c75423
{
sym_link *dtype;
symbol *rlbl = newiTempLabel (NULL);
{
sym_link *dtype;
symbol *rlbl = newiTempLabel (NULL);
+ bool restoreBank=FALSE;
D (emitcode (";", "genPcall ");
);
D (emitcode (";", "genPcall ");
);
the same register bank then we need to save the
destination registers on the stack */
dtype = operandType (IC_LEFT (ic));
the same register bank then we need to save the
destination registers on the stack */
dtype = operandType (IC_LEFT (ic));
+ if (dtype && !IFFUNC_ISNAKED(dtype) &&
IFFUNC_ISISR (currFunc->type) &&
IFFUNC_ISISR (currFunc->type) &&
- (FUNC_REGBANK (currFunc->type) != FUNC_REGBANK (dtype)))
+ (FUNC_REGBANK (currFunc->type) != FUNC_REGBANK (dtype))) {
saveRBank (FUNC_REGBANK (dtype), ic, TRUE);
saveRBank (FUNC_REGBANK (dtype), ic, TRUE);
/* push the return address on to the stack */
emitcode ("mov", "a,#%05d$", (rlbl->key + 100));
/* push the return address on to the stack */
emitcode ("mov", "a,#%05d$", (rlbl->key + 100));
}
/* if register bank was saved then unsave them */
}
/* if register bank was saved then unsave them */
- if (dtype &&
- (FUNC_REGBANK (currFunc->type) !=
- FUNC_REGBANK (dtype)))
unsaveRBank (FUNC_REGBANK (dtype), ic, TRUE);
unsaveRBank (FUNC_REGBANK (dtype), ic, TRUE);
/* if we hade saved some registers then
unsave them */
/* if we hade saved some registers then
unsave them */
+ if (ic->regsSaved && !IFFUNC_CALLEESAVES(dtype))
Made everything static
-------------------------------------------------------------------------*/
Made everything static
-------------------------------------------------------------------------*/
-#define D(x)
-//#define D(x) x
+//#define D(x)
+#define D(x) x
#include <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdlib.h>
+ D(emitcode (";", "genNotFloat"));
+
/* we will put 127 in the first byte of
the result */
aopPut (AOP (res), "#127", 0);
/* we will put 127 in the first byte of
the result */
aopPut (AOP (res), "#127", 0);
symbol *tlbl;
sym_link *optype = operandType (IC_LEFT (ic));
symbol *tlbl;
sym_link *optype = operandType (IC_LEFT (ic));
+ D(emitcode (";", "genNot"));
+
/* assign asmOps to operand & result */
aopOp (IC_LEFT (ic), ic, FALSE);
aopOp (IC_RESULT (ic), ic, TRUE);
/* assign asmOps to operand & result */
aopOp (IC_LEFT (ic), ic, FALSE);
aopOp (IC_RESULT (ic), ic, TRUE);
+ D(emitcode (";", "genCpl"));
+
/* assign asmOps to operand & result */
aopOp (IC_LEFT (ic), ic, FALSE);
aopOp (IC_RESULT (ic), ic, TRUE);
/* assign asmOps to operand & result */
aopOp (IC_LEFT (ic), ic, FALSE);
aopOp (IC_RESULT (ic), ic, TRUE);
{
int size, offset = 0;
char *l;
{
int size, offset = 0;
char *l;
+
+ D(emitcode (";", "genUminusFloat"));
+
/* for this we just need to flip the
first it then copy the rest in place */
size = AOP_SIZE (op) - 1;
/* for this we just need to flip the
first it then copy the rest in place */
size = AOP_SIZE (op) - 1;
sym_link *optype, *rtype;
sym_link *optype, *rtype;
+ D(emitcode (";", "genUminus"));
+
/* assign asmops */
aopOp (IC_LEFT (ic), ic, FALSE);
aopOp (IC_RESULT (ic), ic, TRUE);
/* assign asmops */
aopOp (IC_LEFT (ic), ic, FALSE);
aopOp (IC_RESULT (ic), ic, TRUE);
regs *r;
int size, offset = 0;
regs *r;
int size, offset = 0;
+ D(emitcode (";", "genXpush"));
+
aopOp (IC_LEFT (ic), ic, FALSE);
r = getFreePtr (ic, &aop, FALSE);
aopOp (IC_LEFT (ic), ic, FALSE);
r = getFreePtr (ic, &aop, FALSE);
+ D(emitcode (";", "genIpop"));
/* if the temp was not pushed then */
if (OP_SYMBOL (IC_LEFT (ic))->isspilt)
/* if the temp was not pushed then */
if (OP_SYMBOL (IC_LEFT (ic))->isspilt)
bool swapBanks = FALSE;
D(emitcode(";", "genCall"));
bool swapBanks = FALSE;
D(emitcode(";", "genCall"));
/* if send set is not empty the assign */
if (_G.sendSet)
{
/* if send set is not empty the assign */
if (_G.sendSet)
{
{
sym_link *dtype;
symbol *rlbl = newiTempLabel (NULL);
{
sym_link *dtype;
symbol *rlbl = newiTempLabel (NULL);
+ bool restoreBank=FALSE;
D(emitcode(";", "genPCall"));
D(emitcode(";", "genPCall"));
/* if caller saves & we have not saved then */
if (!ic->regsSaved)
saveRegisters (ic);
/* if caller saves & we have not saved then */
if (!ic->regsSaved)
saveRegisters (ic);
the same register bank then we need to save the
destination registers on the stack */
dtype = operandType (IC_LEFT (ic));
the same register bank then we need to save the
destination registers on the stack */
dtype = operandType (IC_LEFT (ic));
+ if (dtype && !FUNC_ISNAKED(dtype) &&
IFFUNC_ISISR (currFunc->type) &&
IFFUNC_ISISR (currFunc->type) &&
- (FUNC_REGBANK (currFunc->type) != FUNC_REGBANK (dtype)))
+ (FUNC_REGBANK (currFunc->type) != FUNC_REGBANK (dtype))) {
saveRBank (FUNC_REGBANK (dtype), ic, TRUE);
saveRBank (FUNC_REGBANK (dtype), ic, TRUE);
/* push the return address on to the stack */
emitcode ("mov", "a,#%05d$", (rlbl->key + 100));
/* push the return address on to the stack */
emitcode ("mov", "a,#%05d$", (rlbl->key + 100));
}
/* if register bank was saved then unsave them */
}
/* if register bank was saved then unsave them */
- if (dtype &&
- (FUNC_REGBANK (currFunc->type) !=
- FUNC_REGBANK (dtype)))
unsaveRBank (FUNC_REGBANK (dtype), ic, TRUE);
/* if we hade saved some registers then
unsave them */
unsaveRBank (FUNC_REGBANK (dtype), ic, TRUE);
/* if we hade saved some registers then
unsave them */
+ if (ic->regsSaved && !IFFUNC_CALLEESAVES(dtype))
unsigned int icount;
unsigned int size = getDataSize (IC_RESULT (ic));
unsigned int icount;
unsigned int size = getDataSize (IC_RESULT (ic));
+ D(emitcode (";", "genPlusIncr"));
+
/* will try to generate an increment */
/* if the right side is not a literal
we cannot */
/* will try to generate an increment */
/* if the right side is not a literal
we cannot */
+ D(emitcode (";", "genPlus"));
+
aopOp (IC_LEFT (ic), ic, FALSE);
aopOp (IC_RIGHT (ic), ic, FALSE);
aopOp (IC_RESULT (ic), ic, TRUE);
aopOp (IC_LEFT (ic), ic, FALSE);
aopOp (IC_RIGHT (ic), ic, FALSE);
aopOp (IC_RESULT (ic), ic, TRUE);
unsigned int icount;
unsigned int size = getDataSize (IC_RESULT (ic));
unsigned int icount;
unsigned int size = getDataSize (IC_RESULT (ic));
+ D(emitcode (";", "genMinusDec"));
+
/* will try to generate an increment */
/* if the right side is not a literal
we cannot */
/* will try to generate an increment */
/* if the right side is not a literal
we cannot */
int size, offset = 0;
unsigned long lit = 0L;
int size, offset = 0;
unsigned long lit = 0L;
+ D(emitcode (";", "genXor"));
+
aopOp ((left = IC_LEFT (ic)), ic, FALSE);
aopOp ((right = IC_RIGHT (ic)), ic, FALSE);
aopOp ((result = IC_RESULT (ic)), ic, TRUE);
aopOp ((left = IC_LEFT (ic)), ic, FALSE);
aopOp ((right = IC_RIGHT (ic)), ic, FALSE);
aopOp ((result = IC_RESULT (ic)), ic, TRUE);
{
char *buffer, *bp, *bp1;
{
char *buffer, *bp, *bp1;
+ D(emitcode (";", "genInline"));
+
_G.inLine += (!options.asmpeep);
buffer = bp = bp1 = Safe_calloc(1, strlen(IC_INLINE(ic))+1);
_G.inLine += (!options.asmpeep);
buffer = bp = bp1 = Safe_calloc(1, strlen(IC_INLINE(ic))+1);
int size, offset = 0;
char *l;
int size, offset = 0;
char *l;
+ D(emitcode (";", "genRRC"));
+
/* rotate right with carry */
left = IC_LEFT (ic);
result = IC_RESULT (ic);
/* rotate right with carry */
left = IC_LEFT (ic);
result = IC_RESULT (ic);
int size, offset = 0;
char *l;
int size, offset = 0;
char *l;
+ D(emitcode (";", "genRLC"));
+
/* rotate right with carry */
left = IC_LEFT (ic);
result = IC_RESULT (ic);
/* rotate right with carry */
left = IC_LEFT (ic);
result = IC_RESULT (ic);
genGetHbit (iCode * ic)
{
operand *left, *result;
genGetHbit (iCode * ic)
{
operand *left, *result;
+
+ D(emitcode (";", "genGetHbit"));
+
left = IC_LEFT (ic);
result = IC_RESULT (ic);
aopOp (left, ic, FALSE);
left = IC_LEFT (ic);
result = IC_RESULT (ic);
aopOp (left, ic, FALSE);
static void
genlshOne (operand * result, operand * left, int shCount)
{
static void
genlshOne (operand * result, operand * left, int shCount)
{
+ D(emitcode (";", "genlshOne"));
+
shiftL1Left2Result (left, LSB, result, LSB, shCount);
}
shiftL1Left2Result (left, LSB, result, LSB, shCount);
}
+ D(emitcode (";", "genlshTwo"));
+
size = getDataSize (result);
/* if shCount >= 8 */
size = getDataSize (result);
/* if shCount >= 8 */
+ D(emitcode (";", "genlshFour"));
+
size = AOP_SIZE (result);
/* if shifting more that 3 bytes */
size = AOP_SIZE (result);
/* if shifting more that 3 bytes */
int shCount = (int) floatFromVal (AOP (right)->aopu.aop_lit);
int size;
int shCount = (int) floatFromVal (AOP (right)->aopu.aop_lit);
int size;
+ D(emitcode (";", "genLeftShiftLiteral"));
+
freeAsmop (right, NULL, ic, TRUE);
aopOp (left, ic, FALSE);
freeAsmop (right, NULL, ic, TRUE);
aopOp (left, ic, FALSE);
char *l;
symbol *tlbl, *tlbl1;
char *l;
symbol *tlbl, *tlbl1;
+ D(emitcode (";", "genLeftShift"));
+
right = IC_RIGHT (ic);
left = IC_LEFT (ic);
result = IC_RESULT (ic);
right = IC_RIGHT (ic);
left = IC_LEFT (ic);
result = IC_RESULT (ic);
genrshOne (operand * result, operand * left,
int shCount, int sign)
{
genrshOne (operand * result, operand * left,
int shCount, int sign)
{
+ D(emitcode (";", "genrshOne"));
+
shiftR1Left2Result (left, LSB, result, LSB, shCount, sign);
}
shiftR1Left2Result (left, LSB, result, LSB, shCount, sign);
}
genrshTwo (operand * result, operand * left,
int shCount, int sign)
{
genrshTwo (operand * result, operand * left,
int shCount, int sign)
{
+ D(emitcode (";", "genrshTwo"));
+
/* if shCount >= 8 */
if (shCount >= 8)
{
/* if shCount >= 8 */
if (shCount >= 8)
{
genrshFour (operand * result, operand * left,
int shCount, int sign)
{
genrshFour (operand * result, operand * left,
int shCount, int sign)
{
+ D(emitcode (";", "genrshFour"));
+
/* if shifting more that 3 bytes */
if (shCount >= 24)
{
/* if shifting more that 3 bytes */
if (shCount >= 24)
{
int shCount = (int) floatFromVal (AOP (right)->aopu.aop_lit);
int size;
int shCount = (int) floatFromVal (AOP (right)->aopu.aop_lit);
int size;
+ D(emitcode (";", "genRightShiftLiteral"));
+
freeAsmop (right, NULL, ic, TRUE);
aopOp (left, ic, FALSE);
freeAsmop (right, NULL, ic, TRUE);
aopOp (left, ic, FALSE);
char *l;
symbol *tlbl, *tlbl1;
char *l;
symbol *tlbl, *tlbl1;
+ D(emitcode (";", "genSignedRightShift"));
+
/* we do it the hard way put the shift count in b
and loop thru preserving the sign */
/* we do it the hard way put the shift count in b
and loop thru preserving the sign */
char *l;
symbol *tlbl, *tlbl1;
char *l;
symbol *tlbl, *tlbl1;
+ D(emitcode (";", "genRightShift"));
+
/* if signed then we do it the hard way preserve the
sign bit moving it inwards */
retype = getSpec (operandType (IC_RESULT (ic)));
/* if signed then we do it the hard way preserve the
sign bit moving it inwards */
retype = getSpec (operandType (IC_RESULT (ic)));
int offset = 0;
int rsize;
int offset = 0;
int rsize;
+ D(emitcode (";", "genUnpackBits"));
+
etype = getSpec (operandType (result));
rsize = getSize (operandType (result));
/* read the first byte */
etype = getSpec (operandType (result));
rsize = getSize (operandType (result));
/* read the first byte */
char *l;
char buffer[256];
int size, offset = 0;
char *l;
char buffer[256];
int size, offset = 0;
+
+ D(emitcode (";", "genDataPointerGet"));
+
aopOp (result, ic, TRUE);
/* get the string representation of the name */
aopOp (result, ic, TRUE);
/* get the string representation of the name */
sym_link *ltype = operandType (left);
char buffer[80];
sym_link *ltype = operandType (left);
char buffer[80];
+ D(emitcode (";", "genNearPointerGet"));
+
rtype = operandType (result);
retype = getSpec (rtype);
rtype = operandType (result);
retype = getSpec (rtype);
char *rname;
sym_link *rtype, *retype;
char *rname;
sym_link *rtype, *retype;
+ D(emitcode (";", "genPagedPointerGet"));
+
rtype = operandType (result);
retype = getSpec (rtype);
rtype = operandType (result);
retype = getSpec (rtype);
int size, offset;
sym_link *retype = getSpec (operandType (result));
int size, offset;
sym_link *retype = getSpec (operandType (result));
+ D(emitcode (";", "genFarPointerGet"));
+
aopOp (left, ic, FALSE);
/* if the operand is already in dptr
aopOp (left, ic, FALSE);
/* if the operand is already in dptr
int size, offset;
sym_link *retype = getSpec (operandType (result));
int size, offset;
sym_link *retype = getSpec (operandType (result));
+ D(emitcode (";", "genCodePointerGet"));
+
aopOp (left, ic, FALSE);
/* if the operand is already in dptr
aopOp (left, ic, FALSE);
/* if the operand is already in dptr
int size, offset;
sym_link *retype = getSpec (operandType (result));
int size, offset;
sym_link *retype = getSpec (operandType (result));
+ D(emitcode (";", "genGenPointerGet"));
+
aopOp (left, ic, FALSE);
/* if the operand is already in dptr
aopOp (left, ic, FALSE);
/* if the operand is already in dptr
sym_link *type, *etype;
int p_type;
sym_link *type, *etype;
int p_type;
+ D(emitcode (";", "genPointerGet"));
+
left = IC_LEFT (ic);
result = IC_RESULT (ic);
left = IC_LEFT (ic);
result = IC_RESULT (ic);
+ D(emitcode (";", "genPackBits"));
+
blen = SPEC_BLEN (etype);
bstr = SPEC_BSTR (etype);
blen = SPEC_BLEN (etype);
bstr = SPEC_BSTR (etype);
int size, offset = 0;
char *l, buffer[256];
int size, offset = 0;
char *l, buffer[256];
+ D(emitcode (";", "genDataPointerSet"));
+
aopOp (right, ic, FALSE);
l = aopGet (AOP (result), 0, FALSE, TRUE);
aopOp (right, ic, FALSE);
l = aopGet (AOP (result), 0, FALSE, TRUE);
sym_link *retype, *letype;
sym_link *ptype = operandType (result);
sym_link *retype, *letype;
sym_link *ptype = operandType (result);
+ D(emitcode (";", "genNearPointerSet"));
+
retype = getSpec (operandType (right));
letype = getSpec (ptype);
aopOp (result, ic, FALSE);
retype = getSpec (operandType (right));
letype = getSpec (ptype);
aopOp (result, ic, FALSE);
char *rname, *l;
sym_link *retype, *letype;
char *rname, *l;
sym_link *retype, *letype;
+ D(emitcode (";", "genPagedPointerSet"));
+
retype = getSpec (operandType (right));
letype = getSpec (operandType (result));
retype = getSpec (operandType (right));
letype = getSpec (operandType (result));
int size, offset;
sym_link *retype = getSpec (operandType (right));
sym_link *letype = getSpec (operandType (result));
int size, offset;
sym_link *retype = getSpec (operandType (right));
sym_link *letype = getSpec (operandType (result));
+
+ D(emitcode (";", "genFarPointerSet"));
+
aopOp (result, ic, FALSE);
/* if the operand is already in dptr
aopOp (result, ic, FALSE);
/* if the operand is already in dptr
sym_link *retype = getSpec (operandType (right));
sym_link *letype = getSpec (operandType (result));
sym_link *retype = getSpec (operandType (right));
sym_link *letype = getSpec (operandType (result));
+ D(emitcode (";", "genGenPointerSet"));
+
aopOp (result, ic, FALSE);
/* if the operand is already in dptr
aopOp (result, ic, FALSE);
/* if the operand is already in dptr
sym_link *type, *etype;
int p_type;
sym_link *type, *etype;
int p_type;
+ D(emitcode (";", "genPointerSet"));
+
right = IC_RIGHT (ic);
result = IC_RESULT (ic);
right = IC_RIGHT (ic);
result = IC_RESULT (ic);
operand *cond = IC_COND (ic);
int isbit = 0;
operand *cond = IC_COND (ic);
int isbit = 0;
+ D(emitcode (";", "genIfx"));
+
aopOp (cond, ic, FALSE);
/* get the value into acc */
aopOp (cond, ic, FALSE);
/* get the value into acc */
symbol *sym = OP_SYMBOL (IC_LEFT (ic));
int size, offset;
symbol *sym = OP_SYMBOL (IC_LEFT (ic));
int size, offset;
+ D(emitcode (";", "genAddrOf"));
+
aopOp (IC_RESULT (ic), ic, FALSE);
/* if the operand is on the stack then we
aopOp (IC_RESULT (ic), ic, FALSE);
/* if the operand is on the stack then we
int size = AOP_SIZE (right);
int offset = 0;
char *l;
int size = AOP_SIZE (right);
int offset = 0;
char *l;
+
+ D(emitcode (";", "genFarFarAssign"));
+
/* first push the right side on to the stack */
while (size--)
{
/* first push the right side on to the stack */
while (size--)
{
+ D(emitcode (";", "genJumpTab"));
+
aopOp (IC_JTCOND (ic), ic, FALSE);
/* get the condition into accumulator */
l = aopGet (AOP (IC_JTCOND (ic)), 0, FALSE, FALSE);
aopOp (IC_JTCOND (ic), ic, FALSE);
/* get the condition into accumulator */
l = aopGet (AOP (IC_JTCOND (ic)), 0, FALSE, FALSE);
+ D(emitcode (";", "genDjnz"));
+
/* if the if condition has a false label
then we cannot save */
if (IC_FALSE (ifx))
/* if the if condition has a false label
then we cannot save */
if (IC_FALSE (ifx))
static void
genReceive (iCode * ic)
{
static void
genReceive (iCode * ic)
{
+ D(emitcode (";", "genReceive"));
+
if (isOperandInFarSpace (IC_RESULT (ic)) &&
(OP_SYMBOL (IC_RESULT (ic))->isspilt ||
IS_TRUE_SYMOP (IC_RESULT (ic))))
if (isOperandInFarSpace (IC_RESULT (ic)) &&
(OP_SYMBOL (IC_RESULT (ic))->isspilt ||
IS_TRUE_SYMOP (IC_RESULT (ic))))
int toSize=getSize(OP_SYMBOL(left)->type);
int count=toSize;
int toSize=getSize(OP_SYMBOL(left)->type);
int count=toSize;
+ D(emitcode (";", "gen51AggregateAssign"));
+
if (SPEC_OCLS(OP_SYMBOL(left)->etype)!=xdata ||
SPEC_OCLS(OP_SYMBOL(right)->etype)!=code) {
// well, this code isn't used yet from anywhere else as for initialising
if (SPEC_OCLS(OP_SYMBOL(left)->etype)!=xdata ||
SPEC_OCLS(OP_SYMBOL(right)->etype)!=code) {
// well, this code isn't used yet from anywhere else as for initialising