* +-----+-----+-----+-----+-----+-----+-----+-----+
*/
-#define R_WORD 0000 /* 16 bit */
-#define R_BYTE 0001 /* 8 bit */
+#define R_WORD 0x00 /* 16 bit */
+#define R_BYTE 0x01 /* 8 bit */
-#define R_AREA 0000 /* Base type */
-#define R_SYM 0002
+#define R_AREA 0x00 /* Base type */
+#define R_SYM 0x02
-#define R_NORM 0000 /* PC adjust */
-#define R_PCR 0004
+#define R_NORM 0x00 /* PC adjust */
+#define R_PCR 0x04
-#define R_BYT1 0000 /* Byte count for R_BYTE = 1 */
-#define R_BYT2 0010 /* Byte count for R_BYTE = 2 */
+#define R_BYT1 0x00 /* Byte count for R_BYTE = 1 */
+#define R_BYT2 0x08 /* Byte count for R_BYTE = 2 */
-#define R_SGND 0000 /* Signed value */
-#define R_USGN 0020 /* Unsigned value */
+#define R_SGND 0x00 /* Signed value */
+#define R_USGN 0x10 /* Unsigned value */
-#define R_NOPAG 0000 /* Page Mode */
-#define R_PAG0 0040 /* Page '0' */
-#define R_PAG 0100 /* Page 'nnn' */
+#define R_NOPAG 0x00 /* Page Mode */
+#define R_PAG0 0x20 /* Page '0' */
+#define R_PAG 0x40 /* Page 'nnn' */
/*
* Valid for R_BYT2:
*/
-#define R_LSB 0000 /* output low byte */
-#define R_MSB 0200 /* output high byte */
+#define R_LSB 0x00 /* output low byte */
+#define R_MSB 0x80 /* output high byte */
/*
* Global symbol types.
}
i = 0;
while (i < nmsym) {
- if ((strncmp("l__", p[i]->s_id, 3)!=0)&&(strchr(p[i]->s_id,' ')==NULL)) {
+ /* no$gmb requires the symbol names to be less than 32 chars long. Truncate. */
+ char name[32];
+ strncpy(name, p[i]->s_id, 31);
+ name[31] = '\0';
+ if ((strncmp("l__", name, 3)!=0)&&(strchr(name,' ')==NULL)) {
a0=p[i]->s_addr + p[i]->s_axp->a_addr;
if (a0>0x7FFFU) {
/* Not inside the ROM, so treat as being in bank zero */
- fprintf(mfp, "00:%04X %s\n", a0, p[i]->s_id);
+ fprintf(mfp, "00:%04X %s\n", a0, name);
}
else {
- fprintf(mfp, "%02X:%04X %s\n", a0/16384, a0, p[i]->s_id );
+ fprintf(mfp, "%02X:%04X %s\n", a0/16384, a0, name);
}
}
i++;
/* lkmain.c */
-
/*
* (C) Copyright 1989-1995
* All Rights Reserved
{ WARNING,"warning *** possible code generation error at line %d,\n send source to sandeep.dutta@usa.net\n"},
{ WARNING,"warning *** pointer types incompatible \n" },
{ WARNING,"warning *** unknown memory model at %s : %d\n" },
-{ ERROR ,"error *** cannot generate code for target '%s'\n"}
+{ ERROR ,"error *** cannot generate code for target '%s'\n"},
+{ WARNING,"warning *** Indirect call to a banked function not implemented.\n"},
};
/****************************************************************************/
#define W_PTR_ASSIGN 129 /* incampatible pointer assignment */
#define W_UNKNOWN_MODEL 130 /* Unknown memory model */
#define E_UNKNOWN_TARGET 131 /* target not defined */
+#define W_INDIR_BANKED 132 /* Indirect call to a banked fun */
+
void werror(int, ...);
extern struct optimize optimize ;
extern struct options options;
extern int maxInterrupts;
+
+/* Visible from SDCCmain.c */
+extern int nrelFiles;
+extern char *relFiles[128];
+extern char *libFiles[128] ;
+extern int nlibFiles;
+void buildCmdLine(char *into, char **args, const char **cmds,
+ const char *p1, const char *p2,
+ const char *p3, const char **list);
+int my_system (const char *cmd, char **cmd_argv);
+
void parseWithComma (char **,char *) ;
/** Creates a temporary file a'la tmpfile which avoids the bugs
*p = '\0';
if (p != buf)
tfprintf(ofile, "\t!ascii\n", buf);
- tfprintf(ofile, "\t!db\n", *s);
+ tfprintf(ofile, "\t!db !constbyte\n", *s);
p = buf;
}
else {
else
len = 0;
}
- tfprintf(ofile, "\t!db\n", 0);
+ tfprintf(ofile, "\t!db !constbyte\n", 0);
}
/*-----------------------------------------------------------------*/
switch (getSize (type)) {
case 1:
if (!val)
- tfprintf(oFile, "\t!db\n", 0);
+ tfprintf(oFile, "\t!db !constbyte\n", 0);
else
tfprintf(oFile, "\t!dbs\n",
aopLiteral (val, 0));
break;
case 4:
if (!val) {
- tfprintf (oFile, "\t!dw\n", 0);
- tfprintf (oFile, "\t!dw\n", 0);
+ tfprintf (oFile, "\t!dw !constword\n", 0);
+ tfprintf (oFile, "\t!dw !constword\n", 0);
}
else {
fprintf (oFile, "\t.byte %s,%s,%s,%s\n",
if ((remain = (DCL_ELEM (type) - strlen (SPEC_CVAL (val->etype).v_char) -1))>0)
while (remain--)
- tfprintf (oFile, "\t!db\n", 0);
+ tfprintf (oFile, "\t!db !constbyte\n", 0);
return 1;
}
val = list2val (ilist);
/* check the types */
if ((dLvl = checkType (val->type, type->next)) <= 0) {
- tfprintf(oFile, "\t!dw\n", 0);
+ tfprintf(oFile, "\t!dw !constword\n", 0);
return;
}
/* now generate the name */
if (!val->sym) {
if (port->use_dw_for_init)
- tfprintf(oFile, "\t!dw %s\n", val->name);
+ tfprintf(oFile, "\t!dws\n", val->name);
else
fprintf(oFile, "\t.byte %s,(%s >> 8)\n", val->name,val->name);
}
if (IS_LITERAL (val->etype)) {
switch (getSize (type)) {
case 1:
- tfprintf(oFile, "\t!db\n", (unsigned int)floatFromVal(val) & 0xff);
+ tfprintf(oFile, "\t!db !constbyte\n", (unsigned int)floatFromVal(val) & 0xff);
break;
case 2:
tfprintf (oFile, "\t.byte %s,%s\n", aopLiteral(val, 0),aopLiteral(val, 1));
exit(1);
}
-static void _buildCmdLine(char *into, char **args, const char **cmds,
+void buildCmdLine(char *into, char **args, const char **cmds,
const char *p1, const char *p2,
const char *p3, const char **list)
{
/* See if it has a '$' anywhere - if not, just copy */
if ((p = strchr(from, '$'))) {
strncpy(into, from, p - from);
+ /* NULL terminate it */
+ into[p-from] = '\0';
from = p+2;
p++;
switch (*p) {
/* if the extention is type .rel or .r or .REL or .R
addtional object file will be passed to the linker */
if (strcmp(fext,".r") == 0 || strcmp(fext,".rel") == 0 ||
- strcmp(fext,".R") == 0 || strcmp(fext,".REL") == 0) {
-
+ strcmp(fext,".R") == 0 || strcmp(fext,".REL") == 0 ||
+ strcmp(fext, port->linker.rel_ext) == 0)
+ {
relFiles[nrelFiles++] = s;
return ;
}
fprintf (lnkfile,"\n-e\n");
fclose(lnkfile);
- _buildCmdLine(buffer, argv, port->linker.cmd, srcFileName, NULL, NULL, NULL);
+ buildCmdLine(buffer, argv, port->linker.cmd, srcFileName, NULL, NULL, NULL);
/* call the linker */
if (my_system(argv[0], argv)) {
{
char *argv[128]; /* assembler arguments */
- _buildCmdLine(buffer, argv, port->assembler.cmd, srcFileName, NULL, NULL, asmOptions);
+ buildCmdLine(buffer, argv, port->assembler.cmd, srcFileName, NULL, NULL, asmOptions);
if (my_system(argv[0], argv)) {
perror("Cannot exec assember");
if (!preProcOnly)
preOutName = strdup(tmpnam(NULL));
- _buildCmdLine(buffer, argv, _preCmd, fullSrcFileName,
+ buildCmdLine(buffer, argv, _preCmd, fullSrcFileName,
preOutName, srcFileName, preArgv);
if (my_system(argv[0], argv)) {
!fatalError &&
!noAssemble &&
!options.c1mode &&
- (srcFileName || nrelFiles))
- linkEdit (envp);
+ (srcFileName || nrelFiles)) {
+ if (port->linker.do_link)
+ port->linker.do_link();
+ else
+ linkEdit (envp);
+ }
if (yyin && yyin != stdin)
fclose(yyin);
else {
/* This looks like the wrong order but it turns out OK... */
/* PENDING: isr, bank overhead, ... */
- SPEC_STAK(lval->etype) = SPEC_STAK(lval->sym->etype) = lval->sym->stack = stackPtr;
+ SPEC_STAK(lval->etype) = SPEC_STAK(lval->sym->etype) = lval->sym->stack =
+ stackPtr +
+ (IS_BANKED(currFunc->etype) ? port->stack.banked_overhead : 0) +
+ (IS_ISR(currFunc->etype) ? port->stack.isr_overhead : 0) +
+ 0;
stackPtr += getSize (lval->type);
}
}
#include "common.h"
-#define ENABLE_MICHAELH_REGPARM_HACK 0
+#define ENABLE_MICHAELH_REGPARM_HACK 0
bucket *SymbolTab [256] ; /* the symbol table */
bucket *StructTab [256] ; /* the structure table */
link *floatType;
+#if ENABLE_MICHAELH_REGPARM_HACK
static void _makeRegParam(symbol *sym)
{
value *val ;
val = val->next ;
}
}
+#endif
/*-----------------------------------------------------------------*/
/* initCSupport - create functions for C support routines */
{ "areadata", ".area %s" },
{ "ascii", ".ascii \"%s\"" },
{ "ds", ".ds %d" },
- { "db", ".db %d" },
+ { "db", ".db" },
{ "dbs", ".db %s" },
- { "dw", ".dw %d" },
+ { "dw", ".dw" },
{ "dws", ".dw %s" },
{ "constbyte", "0x%02X" },
{ "constword", "0x%04X" },
"; ---------------------------------"
},
{ "functionlabeldef", "%s:" },
+ { "bankimmeds", "0 ; PENDING: bank support" },
{ NULL, NULL }
};
0
},
{
- _linkCmd
+ _linkCmd,
+ NULL,
+ ".rel"
},
{
_defaultRules
0,
},
{
- -1, 1, 4, 1, 1
+ -1, 1, 4, 1, 1, 0
},
/* avr has an 8 bit mul */
{
0
},
{
- _linkCmd
+ _linkCmd,
+ NULL,
+ ".rel"
},
{
_defaultRules
1
},
{
- +1, 1, 4, 1, 1
+ +1, 1, 4, 1, 1, 0
},
/* mcs51 has an 8 bit mul */
{
struct {
/** Command to run (eg link-z80) */
const char **cmd;
+ /** If non-null will be used to execute the link. */
+ void (*do_link)(void);
+ /** Extention for object files (.rel, .obj, ...) */
+ const char *rel_ext;
} linker;
struct {
int call_overhead;
/** Re-enterant space */
int reent_overhead;
+ /** 'banked' call overhead.
+ Mild overlap with bank_overhead */
+ int banked_overhead;
} stack;
struct {
struct {
int last;
int pushed;
+ int param_offset;
int offset;
+ int pushed_bc;
+ int pushed_de;
} stack;
int frameId;
} _G;
case AOP_STK: {
/* Doesnt include _G.stack.pushed */
int abso = aop->aopu.aop_stk + offset + _G.stack.offset;
+ if (aop->aopu.aop_stk > 0) {
+ abso += _G.stack.param_offset;
+ }
assert(pairId == PAIR_HL);
/* In some cases we can still inc or dec hl */
if (_G.pairs[pairId].last_type == AOP_STK && abs(_G.pairs[pairId].offset - abso) < 3) {
adjustPair(_pairs[pairId].name, &_G.pairs[pairId].offset, abso);
}
else {
- emit2("!ldahlsp", aop->aopu.aop_stk+offset + _G.stack.pushed + _G.stack.offset);
+ emit2("!ldahlsp", abso +_G.stack.pushed);
}
_G.pairs[pairId].offset = abso;
break;
if (bit16)
tsprintf (s,"!immedwords", aop->aopu.aop_immd);
else
- if (offset) {
- wassert(offset == 1);
+ switch (offset) {
+ case 2:
+ tsprintf(s, "!bankimmeds", aop->aopu.aop_immd);
+ break;
+ case 1:
+ tsprintf(s, "!msbimmeds", aop->aopu.aop_immd);
+ break;
+ case 0:
tsprintf(s, "!lsbimmeds", aop->aopu.aop_immd);
+ break;
+ default:
+ wassert(0);
}
- else
- tsprintf(s, "!msbimmeds", aop->aopu.aop_immd);
ALLOC_ATOMIC(rs,strlen(s)+1);
strcpy(rs,s);
return rs;
static void emitCall(iCode *ic, bool ispcall)
{
int pushed_de = 0;
+ link *detype = getSpec(operandType(IC_LEFT(ic)));
+
+ if (IS_BANKED(detype))
+ emit2("; call to a banked function");
/* if caller saves & we have not saved then */
if (!ic->regsSaved) {
}
if (ispcall) {
+ if (IS_BANKED(detype)) {
+ werror(W_INDIR_BANKED);
+ }
aopOp(IC_LEFT(ic),ic,FALSE, FALSE);
if (isLitWord(AOP(IC_LEFT(ic)))) {
else {
symbol *rlbl = newiTempLabel(NULL);
spillPair(PAIR_HL);
- emit2("ld hl,#!tlabel", (rlbl->key+100));
+ emit2("ld hl,!immed!tlabel", (rlbl->key+100));
emitcode("push", "hl");
_G.stack.pushed += 2;
freeAsmop(IC_LEFT(ic),NULL,ic);
}
else {
- /* make the call */
char *name = OP_SYMBOL(IC_LEFT(ic))->rname[0] ?
OP_SYMBOL(IC_LEFT(ic))->rname :
OP_SYMBOL(IC_LEFT(ic))->name;
- emitcode("call", "%s", name);
+ if (IS_BANKED(detype)) {
+ emit2("call banked_call");
+ emit2("!dws", name);
+ emit2("!dw !bankimmeds", name);
+ }
+ else {
+ /* make the call */
+ emit2("call %s", name);
+ }
}
spillCached();
}
/* PENDING: callee-save etc */
+ /* If BC or DE are used, then push */
+ _G.stack.pushed_bc = 0;
+ _G.stack.pushed_de = 0;
+ _G.stack.param_offset = 0;
+ if (sym->regsUsed) {
+ int i;
+ for ( i = 0 ; i < sym->regsUsed->size ; i++) {
+ if (bitVectBitValue(sym->regsUsed, i)) {
+ switch (i) {
+ case C_IDX:
+ case B_IDX:
+ _G.stack.pushed_bc = 1;
+ break;
+ case D_IDX:
+ case E_IDX:
+ if (IS_Z80)
+ _G.stack.pushed_de = 1;
+ break;
+ }
+ }
+ }
+ if (_G.stack.pushed_bc) {
+ emit2("push bc");
+ _G.stack.param_offset += 2;
+ }
+ if (_G.stack.pushed_de) {
+ emit2("push de");
+ _G.stack.param_offset += 2;
+ }
+ }
+
/* adjust the stack for the function */
_G.stack.last = sym->stack;
emit2("!leavex", _G.stack.offset);
else
emit2("!leave");
+
+ if (_G.stack.pushed_de)
+ emit2("pop de");
+ if (_G.stack.pushed_bc)
+ emit2("pop bc");
+ /* Both baned and non-banked just ret */
+ emit2("ret");
+
/* PENDING: portability. */
emit2("__%s_end:", sym->rname);
}
if (IS_GB) {
if (sym->onStack) {
spillCached();
- emit2("!ldahlsp", sym->stack + _G.stack.pushed + _G.stack.offset);
+ if (sym->stack <= 0) {
+ emit2("!ldahlsp", sym->stack + _G.stack.pushed + _G.stack.offset);
+ }
+ else {
+ emit2("!ldahlsp", sym->stack + _G.stack.pushed + _G.stack.offset + _G.stack.param_offset);
+ }
emitcode("ld", "d,h");
emitcode("ld", "e,l");
}
else {
- emitcode("ld", "de,#%s", sym->rname);
+ emit2("ld de,!hashedstr", sym->rname);
}
aopPut(AOP(IC_RESULT(ic)), "e", 0);
aopPut(AOP(IC_RESULT(ic)), "d", 1);
char buffer[128];
sprintf(buffer, "%s", sz+5);
_chomp(buffer);
+ if (!strcmp(buffer, "BASE")) {
+ strcpy(buffer, "HOME");
+ }
gbz80_port.mem.code_name = gc_strdup(buffer);
code->sname = gbz80_port.mem.code_name;
return 0;
return 1;
}
+static const char *_gbz80_rgbasmCmd[] = {
+ "rgbasm", "-o$1.o", "$1.asm", NULL
+};
+
+static const char *_gbz80_rgblinkCmd[] = {
+ "xlink", "-tg", "-n$1.sym", "-m$1.map", "-zFF", "$1.lnk", NULL
+};
+
+static void _gbz80_rgblink(void)
+{
+ FILE *lnkfile;
+ const char *sz;
+ char *argv[128];
+
+ int i;
+ sz = srcFileName;
+ if (!sz)
+ sz = "a";
+
+ /* first we need to create the <filename>.lnk file */
+ sprintf(buffer,"%s.lnk", sz);
+ if (!(lnkfile = fopen(buffer,"w"))) {
+ werror(E_FILE_OPEN_ERR, buffer);
+ exit(1);
+ }
+
+ fprintf(lnkfile, "[Objects]\n");
+
+ if (srcFileName)
+ fprintf(lnkfile, "%s.o\n", sz);
+
+ for (i = 0 ; i < nrelFiles ; i++ )
+ fprintf (lnkfile,"%s\n",relFiles[i]);
+
+ fprintf(lnkfile, "\n[Libraries]\n");
+ /* additional libraries if any */
+ for (i = 0 ; i < nlibFiles; i++)
+ fprintf (lnkfile,"%s\n",libFiles[i]);
+
+
+ fprintf(lnkfile,"\n[Output]\n" "%s.gb",sz);
+
+ fclose(lnkfile);
+
+ buildCmdLine(buffer, argv, port->linker.cmd, sz, NULL, NULL, NULL);
+ /* call the linker */
+ if (my_system(argv[0], argv)) {
+ perror("Cannot exec linker");
+ exit(1);
+ }
+}
+
static bool _parseOptions(int *pargc, char **argv, int *i)
{
if (argv[*i][0] == '-') {
else if (!strncmp(argv[*i], "--asm=", 6)) {
if (!strcmp(argv[*i], "--asm=rgbds")) {
asm_addTree(&_rgbds_gb);
+ gbz80_port.assembler.cmd = _gbz80_rgbasmCmd;
+ gbz80_port.linker.cmd = _gbz80_rgblinkCmd;
+ gbz80_port.linker.do_link = _gbz80_rgblink;
_G.fsetAsmType = TRUE;
return TRUE;
}
};
static const char *_z80_asmCmd[] = {
- "as-z80", "-plosgff", "$1.o", "$1.asm", NULL
+ "as-z80", "-plosgff", "$1.asm", NULL
};
/** $1 is always the basename.
"-plosgff", /* Options without debug */
},
{
- _z80_linkCmd
+ _z80_linkCmd,
+ NULL,
+ ".o"
},
{
_z80_defaultRules
1
},
{
- -1, 0, 0, 8, 0
+ -1, 0, 0, 4, 0, 2
},
/* Z80 has no native mul/div commands */
{
1
},
{
- _gbz80_linkCmd
+ _gbz80_linkCmd,
+ NULL,
+ ".o"
},
{
_gbz80_defaultRules
1
},
{
- -1, 0, 0, 4, 0
+ -1, 0, 0, 2, 0, 4
},
/* gbZ80 has no native mul/div commands */
{
{ "ldaspsp", "lda sp,%d(sp)" },
{ "*pair", "(%s)" },
{ "shortjp", "jr" },
- { "enter", "push bc" },
+ { "enter", "" },
{ "enterx",
- "push bc\n"
- "\tlda sp,-%d(sp)" },
- { "leave",
- "pop bc\n"
- "\tret"
+ "lda sp,-%d(sp)" },
+ { "leave", ""
},
- { "leavex",
- "lda sp,%d(sp)\n"
- "\tpop bc\n"
- "\tret"
+ { "leavex", "lda sp,%d(sp)"
},
{ "pusha",
"push af\n"
"\tpush hl"
},
{ "adjustsp", "lda sp,-%d(sp)" },
+ { "fileprelude", "" },
{ NULL, NULL }
};
{ "*pair", "(%s)" },
{ "shortjp", "jp" },
{ "enter",
- "push bc\n"
- "\tpush\tde\n"
- "\tpush\tix\n"
+ "push\tix\n"
"\tld\tix,#0\n"
"\tadd\tix,sp" },
{ "enterx",
- "push bc\n"
- "\tpush\tde\n"
- "\tpush\tix\n"
+ "push\tix\n"
"\tld\tix,#0\n"
"\tadd\tix,sp\n"
"\tld\thl,#-%d\n"
"\tld\tsp,hl" },
{ "leave",
"pop\tix\n"
- "\tpop\tde\n"
- "\tpop\tbc\n"
- "\tret"
},
{ "leavex",
"ld sp,ix\n"
"\tpop\tix\n"
- "\tpop\tde\n"
- "\tpop\tbc\n"
- "\tret"
},
{ "pusha",
"push af\n"
"\tGLOBAL __modschar\n"
"\tGLOBAL __moduchar\n"
"\tGLOBAL __modsint\n"
- "\tGLOBAL __moduint"
+ "\tGLOBAL __moduint\n"
+ "\tGLOBAL __mulslong\n"
+ "\tGLOBAL __modslong\n"
+ "\tGLOBAL __divslong\n"
+ "\tGLOBAL banked_call\n"
+ "\tGLOBAL banked_ret\n"
},
{ "functionheader",
"; ---------------------------------\n"
{ "areadata", "SECTION \"DATA\",BSS" },
{ "ascii", "DB \"%s\"" },
{ "ds", "DS %d" },
- { "db", "DB %d" },
+ { "db", "DB" },
{ "dbs", "DB %s" },
- { "dw", "DW %d" },
+ { "dw", "DW" },
{ "dws", "DW %s" },
{ "immed", "" },
{ "constbyte", "$%02X" },
{ "hashedstr", "%s" },
{ "lsbimmeds", "%s & $FF" },
{ "msbimmeds", "%s >> 8" },
+ { "bankimmeds", "BANK(%s)" },
{ "module", "; MODULE %s" },
{ NULL, NULL }
};
},
{ "di", "di" },
{ "adjustsp", "add sp,-%d" },
- { "enter", "push bc" },
- { "enterx",
- "push bc\n"
- "\tadd sp,-%d"
+ { "enter", "" },
+ { "enterx", "add sp,-%d"
},
- { "leave",
- "pop bc\n"
- "\tret"
+ { "leave", ""
},
- { "leavex",
- "add sp,%d\n"
- "\tpop bc\n"
- "\tret"
+ { "leavex", "add sp,%d"
},
{ "ldahli", "ld a,[hl+]" },
{ "*hl", "[hl]" },
"\tGLOBAL __modschar\n"
"\tGLOBAL __moduchar\n"
"\tGLOBAL __modsint\n"
- "\tGLOBAL __moduint"
+ "\tGLOBAL __moduint\n"
+ "\tGLOBAL banked_call\n"
+ "\tGLOBAL banked_ret\n"
},
{ "functionheader",
"; ---------------------------------\n"
{ "areadata", "_DATA\tGROUP" },
{ "ascii", "DB \"%s\"" },
{ "ds", "DS %d" },
- { "db", "DB %d" },
+ { "db", "DB" },
{ "dbs", "DB %s" },
- { "dw", "DW %d" },
+ { "dw", "DW" },
{ "dws", "DW %s" },
{ "immed", "" },
{ "constbyte", "0x%02X" },
{ "hashedstr", "%s" },
{ "lsbimmeds", "%s & 0xFF" },
{ "msbimmeds", "%s >> 8" },
+ { "bankimmeds", "!%s" },
{ "module", "; MODULE %s" },
{ NULL, NULL }
};
},
{ "di", "di" },
{ "adjustsp", "add sp,-%d" },
- { "enter", "push bc" },
- { "enterx",
- "push bc\n"
- "\tadd sp,-%d"
- },
- { "leave",
- "pop bc\n"
- "\tret"
+ { "enter", "" },
+ { "enterx", "add sp,-%d"
},
- { "leavex",
- "add sp,%d\n"
- "\tpop bc\n"
- "\tret"
+ { "leave", ""
},
+ { "leavex", "add sp,%d\n" },
{ "ldahli", "ld a,(hli)" },
{ "*hl", "(hl)" },
{ "ldahlsp", "ldhl sp,%d" },
/* for the first run we don't provide */
/* registers for true symbols we will */
/* see how things go */
- D(D_ALLOC, ("regTypeNum: #2 setting num of %p to 0\n", sym, 0));
+ D(D_ALLOC, ("regTypeNum: #2 setting num of %p to 0\n", sym));
sym->nRegs = 0;
}
}
/* if one of them is a literal then we can */
if ((IC_LEFT(uic) && IS_OP_LITERAL(IC_LEFT(uic))) ||
(IC_RIGHT(uic) && IS_OP_LITERAL(IC_RIGHT(uic)))) {
- OP_SYMBOL(IC_RESULT(ic))->accuse = 1;
+ goto accuse;
return ;
}
return;
}
} while (!bitVectIsZero(uses));
- OP_SYMBOL(IC_RESULT(ic))->accuse = 1;
+ OP_SYMBOL(IC_RESULT(ic))->accuse = ACCUSE_A;
return;
}
/* if one of them is a literal then we can */
if ((IC_LEFT(uic) && IS_OP_LITERAL(IC_LEFT(uic))) ||
(IC_RIGHT(uic) && IS_OP_LITERAL(IC_RIGHT(uic)))) {
- OP_SYMBOL(IC_RESULT(ic))->accuse = 1;
+ goto accuse;
return ;
}
return ;
accuse:
printf("acc ok!\n");
- OP_SYMBOL(IC_RESULT(ic))->accuse = 1;
+ OP_SYMBOL(IC_RESULT(ic))->accuse = ACCUSE_A;
}
/** Does some transformations to reduce register pressure.
#define IS_Z80 (z80_opts.sub == SUB_Z80)
enum {
- ACCUSE_A,
+ ACCUSE_A = 1,
ACCUSE_HL
};