* src/mcs51/main.c (_linkCmd): Added bin path to command.
* src/SDCCmain.c (initValues): Added support for when it it called just to link.
* as/mcs51/lklibr.c (libfil;): Turned off 'library file' message.
* src/SDCCval.c (constVal): Fixed usage of 'L' modifier problems on ppc.
* support/regression/tests/longor.c: Added.
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1396
4a8a32a2-be11-0410-ad9d-
d568d2c75423
2001-10-13 Michael Hope <michaelh@juju.net.nz>
2001-10-13 Michael Hope <michaelh@juju.net.nz>
+ * src/SDCCmain.c (linkEdit): Added support for passing a legacy command line through the processor.
+
+ * src/mcs51/main.c (_linkCmd): Added bin path to command.
+
+ * src/SDCCmain.c (initValues): Added support for when it it called just to link.
+
+ * as/mcs51/lklibr.c (libfil;): Turned off 'library file' message.
+
* src/SDCCval.c (constVal): Fixed usage of 'L' modifier problems on ppc.
* support/regression/tests/longor.c: Added.
* src/SDCCval.c (constVal): Fixed usage of 'L' modifier problems on ppc.
* support/regression/tests/longor.c: Added.
lbnh->libfil = (char *) new (strlen(libfil) + 1);
strcpy(lbnh->libfil,libfil);
lbnh->libspc = str;
lbnh->libfil = (char *) new (strlen(libfil) + 1);
strcpy(lbnh->libfil,libfil);
lbnh->libspc = str;
- fprintf(stderr,"library file %s\n",str);
bool fdidsomething = FALSE;
char *pinto = apinto;
bool fdidsomething = FALSE;
char *pinto = apinto;
- assert(pinto && pvals && pfrom);
+ assert(pinto);
+ assert(pvals);
+ assert(pfrom);
- buildCmdLine (buffer, port->linker.cmd, srcFileName, NULL, NULL, NULL);
+ char buffer2[PATH_MAX];
+ buildCmdLine (buffer2, port->linker.cmd, srcFileName, NULL, NULL, NULL);
+ buildCmdLine2 (buffer, buffer2);
{
populateMainValues (_baseValues);
setMainValue ("port", port->target);
{
populateMainValues (_baseValues);
setMainValue ("port", port->target);
- setMainValue ("fullsrcfilename", fullSrcFileName);
- setMainValue ("srcfilename", srcFileName);
setMainValue ("objext", port->linker.rel_ext);
setMainValue ("asmext", port->assembler.file_ext);
setMainValue ("objext", port->linker.rel_ext);
setMainValue ("asmext", port->assembler.file_ext);
+
+ setMainValue ("fullsrcfilename", fullSrcFileName ? fullSrcFileName : "fullsrcfilename");
+ setMainValue ("srcfilename", srcFileName ? srcFileName : "srcfilename");
+ initValues ();
+ _discoverPaths (argv[0]);
+
- initValues ();
- _discoverPaths (argv[0]);
-
preProcess (envp);
initMem ();
preProcess (envp);
initMem ();
void
setMainValue (const char *pname, const char *pvalue)
{
void
setMainValue (const char *pname, const char *pvalue)
{
+ assert(pname);
+ assert(pvalue);
+
shash_add (&_mainValues, pname, pvalue);
}
void
buildCmdLine2 (char *pbuffer, const char *pcmd)
{
shash_add (&_mainValues, pname, pvalue);
}
void
buildCmdLine2 (char *pbuffer, const char *pcmd)
{
- char *poutcmd = msprintf(_mainValues, pcmd);
+ char *poutcmd;
+ assert(pbuffer && pcmd);
+ assert(_mainValues);
+
+ poutcmd = msprintf(_mainValues, pcmd);
strcpy(pbuffer, poutcmd);
}
strcpy(pbuffer, poutcmd);
}
*/
static const char *_linkCmd[] =
{
*/
static const char *_linkCmd[] =
{
- "aslink", "-nf", "$1", NULL
+ "{bindir}{sep}aslink", "-nf", "$1", NULL
};
/* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */
};
/* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */
extern FILE *codeOutFile;
extern FILE *codeOutFile;
+enum
+ {
+ INT8MIN = -128,
+ INT8MAX = 127
+ };
+
/** Enum covering all the possible register pairs.
*/
typedef enum
/** Enum covering all the possible register pairs.
*/
typedef enum
if (sym->onStack || sym->iaccess)
{
/* The pointer that is used depends on how big the offset is.
if (sym->onStack || sym->iaccess)
{
/* The pointer that is used depends on how big the offset is.
- Normally everything is AOP_STK, but for offsets of < -127 or
- > 128 on the Z80 an extended stack pointer is used.
+ Normally everything is AOP_STK, but for offsets of < -128 or
+ > 127 on the Z80 an extended stack pointer is used.
- if (IS_Z80 && (options.ommitFramePtr || sym->stack < -127 || sym->stack > (int)(128-getSize (sym->type))))
+ if (IS_Z80 && (options.ommitFramePtr || sym->stack < INT8MIN || sym->stack > (int)(INT8MAX-getSize (sym->type))))
{
emitDebug ("; AOP_EXSTK for %s", sym->rname);
sym->aop = aop = newAsmop (AOP_EXSTK);
{
emitDebug ("; AOP_EXSTK for %s", sym->rname);
sym->aop = aop = newAsmop (AOP_EXSTK);
adjustPair (pair, &_G.pairs[pairId].offset, offset);
return;
}
adjustPair (pair, &_G.pairs[pairId].offset, offset);
return;
}
- if (pairId == PAIR_IY && abs (offset) < 127)
+ if (pairId == PAIR_IY && (offset >= INT8MIN && offset <= INT8MAX))
fetchPair (PAIR_HL, aop);
}
fetchPair (PAIR_HL, aop);
}
+static void
+setupPairFromSP (PAIR_ID id, int offset)
+{
+ wassertl (id == PAIR_HL, "Setup relative to SP only implemented for HL");
+
+ if (offset < INT8MIN || offset > INT8MAX)
+ {
+ emit2 ("ld hl,!immedword", offset);
+ emit2 ("add hl,sp");
+ }
+ else
+ {
+ emit2 ("!ldahlsp", offset);
+ }
+}
+
static void
setupPair (PAIR_ID pairId, asmop * aop, int offset)
{
static void
setupPair (PAIR_ID pairId, asmop * aop, int offset)
{
- emit2 ("!ldahlsp", abso + _G.stack.pushed);
+ setupPairFromSP (PAIR_HL, abso + _G.stack.pushed);
}
_G.pairs[pairId].offset = abso;
break;
}
_G.pairs[pairId].offset = abso;
break;
/* adjust the stack for the function */
_G.stack.last = sym->stack;
/* adjust the stack for the function */
_G.stack.last = sym->stack;
+ if (sym->stack && IS_GB && sym->stack > -INT8MIN)
+ emit2 ("!enterxl", sym->stack);
+ else if (sym->stack)
emit2 ("!enterx", sym->stack);
else
emit2 ("!enter");
emit2 ("!enterx", sym->stack);
else
emit2 ("!enter");
/* PENDING: calleeSave */
/* PENDING: calleeSave */
+ if (_G.stack.offset && IS_GB && _G.stack.offset > INT8MAX)
+ {
+ emit2 ("!leavexl", _G.stack.offset);
+ }
+ else if (_G.stack.offset)
{
emit2 ("!leavex", _G.stack.offset);
}
{
emit2 ("!leavex", _G.stack.offset);
}
spillCached ();
if (sym->stack <= 0)
{
spillCached ();
if (sym->stack <= 0)
{
- emit2 ("!ldahlsp", sym->stack + _G.stack.pushed + _G.stack.offset);
+ setupPairFromSP (PAIR_HL, sym->stack + _G.stack.pushed + _G.stack.offset);
- emit2 ("!ldahlsp", sym->stack + _G.stack.pushed + _G.stack.offset + _G.stack.param_offset);
+ setupPairFromSP (PAIR_HL, sym->stack + _G.stack.pushed + _G.stack.offset + _G.stack.param_offset);
- emit2 ("ld d,h");
- emit2 ("ld e,l");
+ commitPair (AOP (IC_RESULT (ic)), PAIR_HL);
}
else
{
emit2 ("ld de,!hashedstr", sym->rname);
}
else
{
emit2 ("ld de,!hashedstr", sym->rname);
+ commitPair (AOP (IC_RESULT (ic)), PAIR_DE);
- aopPut (AOP (IC_RESULT (ic)), "e", 0);
- aopPut (AOP (IC_RESULT (ic)), "d", 1);
{
emit2 ("ld hl,#%s", sym->rname);
}
{
emit2 ("ld hl,#%s", sym->rname);
}
- aopPut (AOP (IC_RESULT (ic)), "l", 0);
- aopPut (AOP (IC_RESULT (ic)), "h", 1);
+ commitPair (AOP (IC_RESULT (ic)), PAIR_HL);
}
freeAsmop (IC_RESULT (ic), NULL, ic);
}
}
freeAsmop (IC_RESULT (ic), NULL, ic);
}
{ "enter", "" },
{ "enterx",
"lda sp,-%d(sp)" },
{ "enter", "" },
{ "enterx",
"lda sp,-%d(sp)" },
+ { "enterxl",
+ "ld hl,#-%d\n"
+ "\tadd\thl,sp\n"
+ "\tld\tsp,hl"
+ },
{ "leave", ""
},
{ "leavex", "lda sp,%d(sp)"
},
{ "leave", ""
},
{ "leavex", "lda sp,%d(sp)"
},
+ { "leavexl",
+ "ld hl,#%d\n"
+ "\tadd\thl,sp\n"
+ "\tld\tsp,hl"
+ },
{ "pusha",
"push af\n"
"\tpush bc\n"
{ "pusha",
"push af\n"
"\tpush bc\n"
SDCC_DIR = ../..
SDCC_EXTRA_DIR = ../../../sdcc-extra
SDCC_DIR = ../..
SDCC_EXTRA_DIR = ../../../sdcc-extra
# Defaults. Override in spec.mk if required.
# Path to SDCC
SDCC = $(SDCC_DIR)/bin/sdcc
# Defaults. Override in spec.mk if required.
# Path to SDCC
SDCC = $(SDCC_DIR)/bin/sdcc