From 56a9e990dcc18d296ee20344d96bde03dad9e8a2 Mon Sep 17 00:00:00 2001 From: michaelh Date: Fri, 2 Nov 2001 04:52:12 +0000 Subject: [PATCH] * src/SDCCmain.c (linkEdit): Added runtime path detection to the mcs51 port. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1485 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCmacro.c | 16 ++++++++++++++++ src/SDCCmacro.h | 2 ++ src/SDCCmain.c | 2 +- src/SDCCutil.c | 5 +++++ src/SDCCutil.h | 3 +++ src/z80/ralloc.c | 7 ++++++- 6 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/SDCCmacro.c b/src/SDCCmacro.c index b71c20da..4bc7ce43 100644 --- a/src/SDCCmacro.c +++ b/src/SDCCmacro.c @@ -124,3 +124,19 @@ char *msprintf(hTab *pvals, const char *pformat, ...) return pret; } + +void +mfprintf(FILE *fp, hTab *pvals, const char *pformat, ...) +{ + va_list ap; + char *p; + + va_start(ap, pformat); + + p = mvsprintf(pvals, pformat, ap); + + va_end(ap); + + fputs(p, fp); + Safe_free(p); +} diff --git a/src/SDCCmacro.h b/src/SDCCmacro.h index b6b499c9..782096ba 100644 --- a/src/SDCCmacro.h +++ b/src/SDCCmacro.h @@ -28,9 +28,11 @@ #include "SDCChasht.h" #include +#include char *mvsprintf(hTab *pvals, const char *pformat, va_list ap); char *msprintf(hTab *pvals, const char *pformat, ...); +void mfprintf(FILE *fp, hTab *pvals, const char *pformat, ...); #endif diff --git a/src/SDCCmain.c b/src/SDCCmain.c index 63d3937b..705e408f 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -1132,7 +1132,7 @@ linkEdit (char **envp) break; } } - fprintf (lnkfile, "-k %s/%s\n", SDCC_LIB_DIR /*STD_LIB_PATH */ , c); + mfprintf (lnkfile, getRuntimeVariables(), "-k {libdir}{sep}%s\n", c); /* standard library files */ /* if (strcmp (port->target, "ds390") == 0) */ diff --git a/src/SDCCutil.c b/src/SDCCutil.c index a4c9d932..75475d3d 100644 --- a/src/SDCCutil.c +++ b/src/SDCCutil.c @@ -313,3 +313,8 @@ chomp (char *sz) *nl = '\0'; } +hTab * +getRuntimeVariables(void) +{ + return _mainValues; +} diff --git a/src/SDCCutil.h b/src/SDCCutil.h index 7d8f1e2b..e312256c 100644 --- a/src/SDCCutil.h +++ b/src/SDCCutil.h @@ -85,5 +85,8 @@ bool startsWith (const char *sz, const char *key); */ void chomp (char *sz); +hTab * +getRuntimeVariables(void); + #endif diff --git a/src/z80/ralloc.c b/src/z80/ralloc.c index 95682c0f..dd248b71 100644 --- a/src/z80/ralloc.c +++ b/src/z80/ralloc.c @@ -2046,6 +2046,11 @@ packRegsForHLUse (iCode * ic) return; } + if (getSize (operandType (IC_RESULT (ic))) != 2) + { + D (D_HLUSE, (" + Dropping as the result size is not 2\n")); + } + if (IS_Z80) { if (ic->op == CAST && uic->op == IPUSH) @@ -2064,7 +2069,7 @@ packRegsForHLUse (iCode * ic) { goto hluse; } - else if (uic->op == IPUSH) + else if (uic->op == IPUSH && getSize (operandType (IC_LEFT (uic))) == 2) { goto hluse; } -- 2.30.2