git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1152
4a8a32a2-be11-0410-ad9d-
d568d2c75423
/* forward declarations for global variables */
extern ast *staticAutos;
extern FILE *codeOutFile;
/* forward declarations for global variables */
extern ast *staticAutos;
extern FILE *codeOutFile;
-extern memmap *GcurMemmap;
+extern struct memmap *GcurMemmap;
/* forward definitions for functions */
ast *newAst_VALUE (value * val);
/* forward definitions for functions */
ast *newAst_VALUE (value * val);
setype = getSpec (operandType (IC_RESULT (ic)));
setype = getSpec (operandType (IC_RESULT (ic)));
- if (!IC_RIGHT (ic)->noSpilLoc &&
+ if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
!IS_VOLATILE (setype) &&
!IN_FARSPACE (SPEC_OCLS (setype)) &&
/* PENDING */
!IS_VOLATILE (setype) &&
!IN_FARSPACE (SPEC_OCLS (setype)) &&
/* PENDING */
setype = getSpec (operandType (IC_RESULT (ic)));
setype = getSpec (operandType (IC_RESULT (ic)));
- if (!IC_RIGHT (ic)->noSpilLoc &&
+ if (!OP_SYMBOL(IC_RIGHT (ic))->noSpilLoc &&
!IS_VOLATILE (setype) &&
!IN_FARSPACE (SPEC_OCLS (setype)) &&
/* PENDING */
!IS_VOLATILE (setype) &&
!IN_FARSPACE (SPEC_OCLS (setype)) &&
/* PENDING */
if (IS_ITEMP (IC_RESULT (ic)))
{
SPIL_LOC (IC_RESULT (ic)) = NULL;
if (IS_ITEMP (IC_RESULT (ic)))
{
SPIL_LOC (IC_RESULT (ic)) = NULL;
- IC_RESULT (ic)->noSpilLoc = 1;
+ OP_SYMBOL(IC_RESULT (ic))->noSpilLoc = 1;
case SYMBOL:
#define REGA 1
#ifdef REGA
case SYMBOL:
#define REGA 1
#ifdef REGA
- fprintf (file, "%s [k%d lr%d:%d so:%d]{ ia%d re%d rm%d}", /*{ar%d rm%d ru%d p%d a%d u%d i%d au%d k%d ks%d}" , */
+ fprintf (file, "%s [k%d lr%d:%d so:%d]{ ia%d re%d rm%d nos%d}", /*{ar%d rm%d ru%d p%d a%d u%d i%d au%d k%d ks%d}" , */
(OP_SYMBOL (op)->rname[0] ? OP_SYMBOL (op)->rname : OP_SYMBOL (op)->name),
op->key,
OP_LIVEFROM (op), OP_LIVETO (op),
OP_SYMBOL (op)->stack,
(OP_SYMBOL (op)->rname[0] ? OP_SYMBOL (op)->rname : OP_SYMBOL (op)->name),
op->key,
OP_LIVEFROM (op), OP_LIVETO (op),
OP_SYMBOL (op)->stack,
- op->isaddr, OP_SYMBOL (op)->isreqv, OP_SYMBOL (op)->remat
+ op->isaddr, OP_SYMBOL (op)->isreqv, OP_SYMBOL (op)->remat,OP_SYMBOL(op)->noSpilLoc
);
{
fprintf (file, "{");
);
{
fprintf (file, "{");
nop->isvolatile = op->isvolatile;
nop->isGlobal = op->isGlobal;
nop->isLiteral = op->isLiteral;
nop->isvolatile = op->isvolatile;
nop->isGlobal = op->isGlobal;
nop->isLiteral = op->isLiteral;
- nop->noSpilLoc = op->noSpilLoc;
nop->usesDefs = op->usesDefs;
nop->isParm = op->isParm;
return nop;
nop->usesDefs = op->usesDefs;
nop->isParm = op->isParm;
return nop;
nop->isvolatile = op->isvolatile;
nop->isGlobal = op->isGlobal;
nop->isLiteral = op->isLiteral;
nop->isvolatile = op->isvolatile;
nop->isGlobal = op->isGlobal;
nop->isLiteral = op->isLiteral;
- nop->noSpilLoc = op->noSpilLoc;
nop->usesDefs = op->usesDefs;
nop->isParm = op->isParm;
nop->usesDefs = op->usesDefs;
nop->isParm = op->isParm;
}
rOp = newiTempOperand (rvtype, 0);
}
rOp = newiTempOperand (rvtype, 0);
+ OP_SYMBOL(rOp)->noSpilLoc = 1;
+ OP_SYMBOL(rv)->noSpilLoc = 1;
geniCodeAssign (rOp, rv, 0);
geniCodeAssign (rOp, rv, 0);
}
rOp = newiTempOperand (rvtype, 0);
}
rOp = newiTempOperand (rvtype, 0);
+ OP_SYMBOL(rOp)->noSpilLoc = 1;
+ OP_SYMBOL(rv)->noSpilLoc = 1;
geniCodeAssign (rOp, rv, 0);
geniCodeAssign (rOp, rv, 0);
unsigned int isGptr:1; /* is a generic pointer */
unsigned int isParm:1; /* is a parameter */
unsigned int isLiteral:1; /* operand is literal */
unsigned int isGptr:1; /* is a generic pointer */
unsigned int isParm:1; /* is a parameter */
unsigned int isLiteral:1; /* operand is literal */
- unsigned int noSpilLoc:1; /* cannot be assigned a spil location */
unsigned ruonly:1; /* used in return statement only */
unsigned spildir:1; /* spilt in direct space */
unsigned ptrreg:1; /* this symbol assigned to a ptr reg */
unsigned ruonly:1; /* used in return statement only */
unsigned spildir:1; /* spilt in direct space */
unsigned ptrreg:1; /* this symbol assigned to a ptr reg */
+ unsigned noSpilLoc:1; /* cannot be assigned a spil location */
unsigned accuse; /* can be left in the accumulator
On the Z80 accuse is devided into
ACCUSE_A and ACCUSE_HL as the idea
unsigned accuse; /* can be left in the accumulator
On the Z80 accuse is devided into
ACCUSE_A and ACCUSE_HL as the idea
_G.nRegsSaved));
}
else {
_G.nRegsSaved));
}
else {
- emitcode ("subi", "%s,lo8(%d)",
+ emitcode ("subi", "%s,(%d & 0xff)",
aop->aopu.aop_ptr->name,
sym->stack - _G.nRegsSaved);
aop->aopu.aop_ptr->name,
sym->stack - _G.nRegsSaved);
- emitcode ("sbci", "%s,hi8(%d)",
+ emitcode ("sbci", "%s,((%d >> 8) & 0xff)",
aop->aop_ptr2->name,
sym->stack - _G.nRegsSaved);
}
aop->aop_ptr2->name,
sym->stack - _G.nRegsSaved);
}
- emitcode ("subi", "%s,lo8(-%d)",
+ emitcode ("subi", "%s,((-%d) & 0xff)",
aop->aopu.aop_ptr->name,
sym->stack);
aop->aopu.aop_ptr->name,
sym->stack);
- emitcode ("sbci", "%s,hi8(-%d)",
+ emitcode ("sbci", "%s,(((-%d) >> 8) & 0xff))",
aop->aop_ptr2->name,
sym->stack);
}
aop->aop_ptr2->name,
sym->stack);
}
if (currFunc) {
cdbSymbol (currFunc, cdbFile, FALSE, TRUE);
_G.debugLine = 1;
if (currFunc) {
cdbSymbol (currFunc, cdbFile, FALSE, TRUE);
_G.debugLine = 1;
- emitcode ("", ".type %s,@function", currFunc->name);
+/* emitcode ("", ".type %s,@function", currFunc->name); */
_G.debugLine = 0;
}
/* stack pointer name */
_G.debugLine = 0;
}
/* stack pointer name */
static void
_avr_init (void)
{
static void
_avr_init (void)
{
- asm_addTree (&asm_gas_mapping);
+ asm_addTree (&asm_asxxxx_mapping);
MUST be terminated with a NULL.
*/
static const char *_linkCmd[] = {
MUST be terminated with a NULL.
*/
static const char *_linkCmd[] = {
- "avr-ld", "", "$1", NULL
+ "linkavr", "", "$1", NULL
};
static const char *_asmCmd[] = {
};
static const char *_asmCmd[] = {
- "avr-as", "-mmcu=avr3" , "$1.s", NULL
+ "asavr", "$l" , "-plosgff", "$1.s", NULL
- "-plosgffc", /* Options with debug */
+ "-plosgff", /* Options with debug */
"-plosgff", /* Options without debug */
0,
".s"},
"-plosgff", /* Options without debug */
0,
".s"},
if (POINTER_SET (ic))
OP_SYMBOL (IC_RESULT (ic))->uptr = 1;
if (POINTER_SET (ic))
OP_SYMBOL (IC_RESULT (ic))->uptr = 1;
+ if (POINTER_GET (ic)) {
OP_SYMBOL (IC_LEFT (ic))->uptr = 1;
OP_SYMBOL (IC_LEFT (ic))->uptr = 1;
+ if (OP_SYMBOL (IC_LEFT(ic))->remat)
+ OP_SYMBOL (IC_RESULT (ic))->usl.spillLoc = NULL;
+ }
/* if the condition of an if instruction
is defined in the previous instruction then
/* if the condition of an if instruction
is defined in the previous instruction then
else {
regsAVR[R26_IDX].type = (regsAVR[R26_IDX].type & ~REG_MASK) | REG_PTR;
regsAVR[R27_IDX].type = (regsAVR[R27_IDX].type & ~REG_MASK) | REG_PTR;
else {
regsAVR[R26_IDX].type = (regsAVR[R26_IDX].type & ~REG_MASK) | REG_PTR;
regsAVR[R27_IDX].type = (regsAVR[R27_IDX].type & ~REG_MASK) | REG_PTR;
- regsAVR[R28_IDX].type = (regsAVR[R28_IDX].type & ~REG_MASK) | REG_PTR;
- regsAVR[R29_IDX].type = (regsAVR[R29_IDX].type & ~REG_MASK) | REG_PTR;
+ regsAVR[R30_IDX].type = (regsAVR[R30_IDX].type & ~REG_MASK) | REG_PTR;
+ regsAVR[R31_IDX].type = (regsAVR[R31_IDX].type & ~REG_MASK) | REG_PTR;
}
/* registers 0-1 / 24-25 used as scratch */
}
/* registers 0-1 / 24-25 used as scratch */
(ic = hTabItemWithKey (iCodehTab,
bitVectFirstBit (sym->defs))) &&
POINTER_GET (ic) &&
(ic = hTabItemWithKey (iCodehTab,
bitVectFirstBit (sym->defs))) &&
POINTER_GET (ic) &&
!IS_BITVAR (sym->etype))
{
!IS_BITVAR (sym->etype))
{