From f0d3e26f7b91a687dbf34c7e3f56be5f371e1a1e Mon Sep 17 00:00:00 2001 From: michaelh Date: Tue, 16 Apr 2002 03:57:42 +0000 Subject: [PATCH] * device/lib/z80/printf.c (sprintf): Added. * src/z80/ralloc.c (packRegisters): Disabled pack HL use for GB as it's broken. * src/z80/peeph.def: Added transpose redundent load rule. * src/z80/main.c: Added force callee saves for jaune. * src/port.h: Removed the i186 and tlcs-900h ports as they weren't being being developed. * src/SDCCmain.c: Pulled the options definition out so that you can add port specific options without changing the main file. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2010 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 21 ++- configure | 317 +++++++++++++------------------------- configure.in | 18 --- device/lib/_memcpy.c | 5 +- device/lib/_memset.c | 1 - device/lib/gbz80/printf.c | 17 ++ device/lib/z80/printf.c | 17 ++ sdcc.spec | 2 +- sdcc_vc.h | 2 - sdccconf_in.h | 2 - src/SDCCargs.h | 52 +++++++ src/SDCCmain.c | 137 ++++++++-------- src/avr/main.c | 1 + src/ds390/main.c | 2 + src/mcs51/main.c | 1 + src/pic/main.c | 1 + src/port.h | 14 +- src/xa51/main.c | 1 + src/z80/gen.c | 116 +++++++++----- src/z80/main.c | 8 + src/z80/peeph.def | 9 ++ src/z80/ralloc.c | 10 +- src/z80/z80.h | 1 + 23 files changed, 408 insertions(+), 347 deletions(-) create mode 100644 src/SDCCargs.h diff --git a/ChangeLog b/ChangeLog index 7e7ff6e6..41cfd956 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2002-04-15 Michael Hope + + * device/lib/z80/printf.c (sprintf): Added. + + * src/z80/ralloc.c (packRegisters): Disabled pack HL use for GB as it's broken. + + * src/z80/peeph.def: Added transpose redundent load rule. + + * src/z80/main.c: Added force callee saves for jaune. + + * src/port.h: Removed the i186 and tlcs-900h ports as they weren't being being developed. + + * src/SDCCmain.c: Pulled the options definition out so that you can add port specific options without changing the main file. + 2002-03-28 Johan Knol * src/SDCCval.c: fixed bug #532436 @@ -35,7 +49,11 @@ * src/pic/device.c: Added. device.c is a PIC port hack to accomodate variations in PIC devices. - + +2002-03-13 Michael Hope + + * src/z80/gen.c (genGenPointerGet): Fixed a bug where a pointer in HL is dereferenced into HL but HL is not spilled. Yeah. + 2002-03-04 johanknol * /src/SDCCval.c: fixed @@ -87,6 +105,7 @@ * sdcc/src/SDCCcse.c: Better fix for bug # 514308 +>>>>>>> 1.105 2002-03-02 * src/SDCCast.c (decorateType): fixed bug #524708 diff --git a/configure b/configure index 0f47cdaa..8b619b78 100755 --- a/configure +++ b/configure @@ -23,10 +23,6 @@ ac_help="$ac_help --disable-ds390-port Excludes the DS390 port" ac_help="$ac_help --disable-pic-port Excludes the PIC port" -ac_help="$ac_help - --disable-i186-port Excludes the I186 port" -ac_help="$ac_help - --disable-tlcs900h-port Excludes the TLCS900H port" ac_help="$ac_help --disable-xa51-port Excludes the XA51 port" ac_help="$ac_help @@ -549,12 +545,12 @@ fi -for ac_prog in gawk mawk nawk awk +for ac_prog in mawk gawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:558: checking for $ac_word" >&5 +echo "configure:554: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -585,7 +581,7 @@ done echo $ac_n "checking version of the package""... $ac_c" 1>&6 -echo "configure:589: checking version of the package" >&5 +echo "configure:585: checking version of the package" >&5 if test -f .version; then VERSION=`cat .version` elif test -f ../.version; then @@ -649,7 +645,7 @@ sdcc_cv_versionp=$VERSIONP # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:653: checking for $ac_word" >&5 +echo "configure:649: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -679,7 +675,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:683: checking for $ac_word" >&5 +echo "configure:679: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -730,7 +726,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:734: checking for $ac_word" >&5 +echo "configure:730: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -762,7 +758,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:766: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:762: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -773,12 +769,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 777 "configure" +#line 773 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:782: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -804,12 +800,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:808: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:804: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:813: checking whether we are using GNU C" >&5 +echo "configure:809: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -818,7 +814,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:822: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:818: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -837,7 +833,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:841: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:837: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -873,7 +869,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:877: checking for $ac_word" >&5 +echo "configure:873: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -905,7 +901,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:909: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:905: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -916,12 +912,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 920 "configure" +#line 916 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -947,12 +943,12 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:951: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:947: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:956: checking whether we are using GNU C++" >&5 +echo "configure:952: checking whether we are using GNU C++" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -961,7 +957,7 @@ else yes; #endif EOF -if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -980,7 +976,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:984: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:980: checking whether ${CXX-g++} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1011,59 +1007,8 @@ else fi fi -for ac_declaration in \ - ''\ - '#include ' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat > conftest.$ac_ext < -$ac_declaration -int main() { -exit (42); -; return 0; } -EOF -if { (eval echo configure:1033: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - : -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - continue -fi -rm -f conftest* - cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - break -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 -fi -rm -f conftest* -done -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - - echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1067: checking how to run the C preprocessor" >&5 +echo "configure:1012: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1078,13 +1023,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1088: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1033: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1095,13 +1040,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1105: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1050: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1112,13 +1057,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1122: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1067: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1173,7 +1118,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1177: checking for a BSD compatible install" >&5 +echo "configure:1122: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1228,7 +1173,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1232: checking for $ac_word" >&5 +echo "configure:1177: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1258,7 +1203,7 @@ fi # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1262: checking for $ac_word" >&5 +echo "configure:1207: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1292,7 +1237,7 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:1296: checking for yywrap in -l$ac_lib" >&5 +echo "configure:1241: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1300,7 +1245,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1336,7 +1281,7 @@ fi # Extract the first word of "bison", so it can be a program name with args. set dummy bison; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1340: checking for $ac_word" >&5 +echo "configure:1285: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1366,7 +1311,7 @@ fi # Extract the first word of "autoconf", so it can be a program name with args. set dummy autoconf; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1370: checking for $ac_word" >&5 +echo "configure:1315: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AUTOCONF'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1396,7 +1341,7 @@ fi # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1400: checking for $ac_word" >&5 +echo "configure:1345: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1426,7 +1371,7 @@ fi # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1430: checking for $ac_word" >&5 +echo "configure:1375: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1456,7 +1401,7 @@ fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1460: checking for $ac_word" >&5 +echo "configure:1405: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1506,12 +1451,12 @@ cross_compiling=$ac_cv_prog_cc_cross # Checking for header files. # =========================================================================== echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1510: checking for ANSI C header files" >&5 +echo "configure:1455: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1519,7 +1464,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1523: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1468: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1536,7 +1481,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1554,7 +1499,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1575,7 +1520,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1586,7 +1531,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1613,17 +1558,17 @@ for ac_hdr in getopt.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1617: checking for $ac_hdr" >&5 +echo "configure:1562: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1627: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1653,17 +1598,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1657: checking for $ac_hdr" >&5 +echo "configure:1602: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1667: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1693,17 +1638,17 @@ for ac_hdr in endian.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1697: checking for $ac_hdr" >&5 +echo "configure:1642: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1652: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1733,17 +1678,17 @@ for ac_hdr in machine/endian.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1737: checking for $ac_hdr" >&5 +echo "configure:1682: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1692: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1773,17 +1718,17 @@ for ac_hdr in malloc.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1777: checking for $ac_hdr" >&5 +echo "configure:1722: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1813,17 +1758,17 @@ for ac_hdr in sys/isa_defs.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1817: checking for $ac_hdr" >&5 +echo "configure:1762: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1772: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1853,17 +1798,17 @@ for ac_hdr in sys/socket.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1857: checking for $ac_hdr" >&5 +echo "configure:1802: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1867: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1812: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1894,12 +1839,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1898: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1843: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> @@ -1907,7 +1852,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1911: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1856: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1932,7 +1877,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1936: checking for opendir in -ldir" >&5 +echo "configure:1881: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1940,7 +1885,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1973,7 +1918,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1977: checking for opendir in -lx" >&5 +echo "configure:1922: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1981,7 +1926,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2018,13 +1963,13 @@ fi # This must be after CPP echo $ac_n "checking which header file defines FD_ macros""... $ac_c" 1>&6 -echo "configure:2022: checking which header file defines FD_ macros" >&5 +echo "configure:1967: checking which header file defines FD_ macros" >&5 if eval "test \"`echo '$''{'s51_cv_fd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else sdcc_cv_fd="unknown" cat > conftest.$ac_ext < @@ -2040,7 +1985,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < @@ -2056,7 +2001,7 @@ fi rm -f conftest* cat > conftest.$ac_ext < @@ -2136,12 +2081,12 @@ EOF for ac_func in strlen strcpy strcat strstr strcmp strerror strtok strdup do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2140: checking for $ac_func" >&5 +echo "configure:2085: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2191,12 +2136,12 @@ done for ac_func in strchr memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2195: checking for $ac_func" >&5 +echo "configure:2140: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2246,12 +2191,12 @@ done for ac_func in fgets do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2250: checking for $ac_func" >&5 +echo "configure:2195: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2301,12 +2246,12 @@ done for ac_func in yylex do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2305: checking for $ac_func" >&5 +echo "configure:2250: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2357,14 +2302,14 @@ done # check if -lsocket && -lxnet is required to compile socket stuff echo $ac_n "checking for library containing socket""... $ac_c" 1>&6 -echo "configure:2361: checking for library containing socket" >&5 +echo "configure:2306: checking for library containing socket" >&5 if eval "test \"`echo '$''{'ac_cv_search_socket'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_socket="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socket="none required" else @@ -2386,7 +2331,7 @@ rm -f conftest* test "$ac_cv_search_socket" = "no" && for i in socket; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_socket="-l$i" break @@ -2419,14 +2364,14 @@ else : fi echo $ac_n "checking for library containing inet_addr""... $ac_c" 1>&6 -echo "configure:2423: checking for library containing inet_addr" >&5 +echo "configure:2368: checking for library containing inet_addr" >&5 if eval "test \"`echo '$''{'ac_cv_search_inet_addr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_inet_addr="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_inet_addr="none required" else @@ -2448,7 +2393,7 @@ rm -f conftest* test "$ac_cv_search_inet_addr" = "no" && for i in nsl xnet; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_inet_addr="-l$i" break @@ -2493,7 +2438,7 @@ fi # Checking characteristics of compilers and other programs # -------------------------------------------------------- echo $ac_n "checking whether preprocessor accepts -MM or -M""... $ac_c" 1>&6 -echo "configure:2497: checking whether preprocessor accepts -MM or -M" >&5 +echo "configure:2442: checking whether preprocessor accepts -MM or -M" >&5 if eval "test \"`echo '$''{'sdcc_cv_MM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2515,7 +2460,7 @@ M_OR_MM=$sdcc_cv_MM # This is the first time when CFLAGS are set/modified!! echo $ac_n "checking whether $CC accepts -ggdb""... $ac_c" 1>&6 -echo "configure:2519: checking whether $CC accepts -ggdb" >&5 +echo "configure:2464: checking whether $CC accepts -ggdb" >&5 if eval "test \"`echo '$''{'sdcc_cv_CCggdb'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2540,7 +2485,7 @@ fi echo $ac_n "checking whether $CC accepts -pipe""... $ac_c" 1>&6 -echo "configure:2544: checking whether $CC accepts -pipe" >&5 +echo "configure:2489: checking whether $CC accepts -pipe" >&5 if eval "test \"`echo '$''{'sdcc_cv_CCpipe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2567,12 +2512,12 @@ fi # Checks for typedefs, structures, and compiler characteristics. # =========================================================================== echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2571: checking return type of signal handlers" >&5 +echo "configure:2516: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2589,7 +2534,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2538: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2804,46 +2749,6 @@ EOF fi -# Check whether --enable-i186-port or --disable-i186-port was given. -if test "${enable_i186_port+set}" = set; then - enableval="$enable_i186_port" - : -fi - -echo izt >>ports.all -if test "$enable_i186_port" = "no"; then - cat >> confdefs.h <>ports.build - cat >> confdefs.h <>ports.all -if test "$enable_tlcs900h_port" = "no"; then - cat >> confdefs.h <>ports.build - cat >> confdefs.h <&6 -echo "configure:2903: checking for GC_malloc in -lgc" >&5 +echo "configure:2808: checking for GC_malloc in -lgc" >&5 ac_lib_var=`echo gc'_'GC_malloc | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2907,7 +2812,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index 92ed5a00..be8e46f6 100755 --- a/configure.in +++ b/configure.in @@ -275,24 +275,6 @@ else AC_DEFINE_UNQUOTED(OPT_DISABLE_PIC, 0) fi -AC_ARG_ENABLE(i186-port,[ --disable-i186-port Excludes the I186 port]) -echo izt >>ports.all -if test "$enable_i186_port" = "no"; then - AC_DEFINE_UNQUOTED(OPT_DISABLE_I186, 1) -else - echo izt >>ports.build - AC_DEFINE_UNQUOTED(OPT_DISABLE_I186, 0) -fi - -AC_ARG_ENABLE(tlcs900h-port,[ --disable-tlcs900h-port Excludes the TLCS900H port]) -echo izt >>ports.all -if test "$enable_tlcs900h_port" = "no"; then - AC_DEFINE_UNQUOTED(OPT_DISABLE_TLCS900H, 1) -else - echo izt >>ports.build - AC_DEFINE_UNQUOTED(OPT_DISABLE_TLCS900H, 0) -fi - AC_ARG_ENABLE(xa51-port,[ --disable-xa51-port Excludes the XA51 port]) echo xa51 >>ports.all if test "$enable_xa51_port" = "no"; then diff --git a/device/lib/_memcpy.c b/device/lib/_memcpy.c index d5ddf9e7..aebbbb9c 100644 --- a/device/lib/_memcpy.c +++ b/device/lib/_memcpy.c @@ -40,10 +40,9 @@ void * memcpy ( char * d = dst; char * s = src; - int count = -acount; + /* PENDING: Divide first to get around sign problems */ + int count = -(acount/4); - count /= 4; - while (count) { *d++ = *s++; *d++ = *s++; diff --git a/device/lib/_memset.c b/device/lib/_memset.c index a42be818..9d903d2c 100644 --- a/device/lib/_memset.c +++ b/device/lib/_memset.c @@ -22,7 +22,6 @@ what you give them. Help stamp out software-hoarding! -------------------------------------------------------------------------*/ #include "string.h" -#define NULL (void *)0 void * memset ( void * buf, diff --git a/device/lib/gbz80/printf.c b/device/lib/gbz80/printf.c index d584bdb8..370a4e42 100644 --- a/device/lib/gbz80/printf.c +++ b/device/lib/gbz80/printf.c @@ -87,3 +87,20 @@ int printf(const char *format, ...) /* PENDING: What to return? */ return 0; } + +STATIC void _buf_emitter(char c, void *pData) +{ + *((*((char **)pData)))++ = c; +} + +int sprintf(char *pInto, const char *format, ...) +{ + va_list va; + va_start(va, format); + + _printf(format, _buf_emitter, &pInto, va); + *pInto++ = '\0'; + + /* PENDING: What to return? */ + return 0; +} diff --git a/device/lib/z80/printf.c b/device/lib/z80/printf.c index d584bdb8..370a4e42 100644 --- a/device/lib/z80/printf.c +++ b/device/lib/z80/printf.c @@ -87,3 +87,20 @@ int printf(const char *format, ...) /* PENDING: What to return? */ return 0; } + +STATIC void _buf_emitter(char c, void *pData) +{ + *((*((char **)pData)))++ = c; +} + +int sprintf(char *pInto, const char *format, ...) +{ + va_list va; + va_start(va, format); + + _printf(format, _buf_emitter, &pInto, va); + *pInto++ = '\0'; + + /* PENDING: What to return? */ + return 0; +} diff --git a/sdcc.spec b/sdcc.spec index d89fd0cd..b38b65aa 100644 --- a/sdcc.spec +++ b/sdcc.spec @@ -14,7 +14,7 @@ BuildRoot: /tmp/sdcc SDC is a C compiler for 8051 class and similar microcontrollers. The packge includes the compiler, assemblers and linkers, a device simulator and a core library. The processors supported (to a varying -degree) include the 8051, avr, ds390, PIC, i186 and z80. +degree) include the 8051, avr, ds390, PIC, and z80. %prep %setup -n sdcc diff --git a/sdcc_vc.h b/sdcc_vc.h index afd0f294..b5650ca8 100644 --- a/sdcc_vc.h +++ b/sdcc_vc.h @@ -36,8 +36,6 @@ #undef OPT_DISABLE_GBZ80 #undef OPT_DISABLE_MCS51 #undef OPT_DISABLE_AVR -#define OPT_DISABLE_I186 1 -#define OPT_DISABLE_TLCS900H 1 #endif diff --git a/sdccconf_in.h b/sdccconf_in.h index 8359ea53..3a38e3fb 100644 --- a/sdccconf_in.h +++ b/sdccconf_in.h @@ -37,8 +37,6 @@ #undef OPT_DISABLE_DS390 #undef OPT_DISABLE_TININative #undef OPT_DISABLE_PIC -#undef OPT_DISABLE_I186 -#undef OPT_DISABLE_TLCS900H #undef OPT_DISABLE_XA51 #undef OPT_ENABLE_LIBGC diff --git a/src/SDCCargs.h b/src/SDCCargs.h new file mode 100644 index 00000000..42083270 --- /dev/null +++ b/src/SDCCargs.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------------------- + SDCCmain.c - main file + + Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999) + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + In other words, you are welcome to use, share and improve this program. + You are forbidden to forbid anyone else to use, share and improve + what you give them. Help stamp out software-hoarding! +-------------------------------------------------------------------------*/ + +/** Definition of the structures used by the options parser. The port + may implement one of these for any options it wants parsed + automatically. +*/ +#ifndef SDCCARGS_H +#define SDCCARGS_H + +/** Table of all options supported by all ports. + This table provides: + * A reference for all options. + * An easy way to maintain help for the options. + * Automatic support for setting flags on simple options. +*/ +typedef struct { + /** The short option character e.g. 'h' for -h. 0 for none. */ + char shortOpt; + /** Long option e.g. "--help". Includes the -- prefix. NULL for + none. */ + const char *longOpt; + /** Pointer to an int that will be incremented every time the + option is encountered. May be NULL. + */ + int *pparameter; + /** Help text to go with this option. May be NULL. */ + const char *help; +} OPTION; + +#endif diff --git a/src/SDCCmain.c b/src/SDCCmain.c index fa2883d3..27573f58 100644 --- a/src/SDCCmain.c +++ b/src/SDCCmain.c @@ -30,6 +30,7 @@ #include "MySystem.h" #include "SDCCmacro.h" #include "SDCCutil.h" +#include "SDCCargs.h" #if NATIVE_WIN32 #include @@ -115,26 +116,6 @@ char DefaultExePath[128]; #define OPTION_SHORT_IS_8BITS "--short-is-8bits" #define OPTION_TINI_LIBID "--tini-libid" -/** Table of all options supported by all ports. - This table provides: - * A reference for all options. - * An easy way to maintain help for the options. - * Automatic support for setting flags on simple options. -*/ -typedef struct { - /** The short option character e.g. 'h' for -h. 0 for none. */ - char shortOpt; - /** Long option e.g. "--help". Includes the -- prefix. NULL for - none. */ - const char *longOpt; - /** Pointer to an int that will be incremented every time the - option is encountered. May be NULL. - */ - int *pparameter; - /** Help text to go with this option. May be NULL. */ - const char *help; -} OPTION; - static const OPTION optionsTable[] = { { 'm', NULL, NULL, "Set the port to use e.g. -mz80." }, @@ -214,7 +195,9 @@ optionsTable[] = { { 0, "--stack-probe", &options.stack_probe,"insert call to function __stack_probe at each function prologue"}, { 0, "--tini-libid", NULL," LibraryID used in -mTININative"}, { 0, "--protect-sp-update", &options.protect_sp_update,"DS390 - will disable interrupts during ESP:SP updates"}, - { 0, "--parms-in-bank1", &options.parms_in_bank1,"MCS51/DS390 - use Bank1 for parameter passing"} + { 0, "--parms-in-bank1", &options.parms_in_bank1,"MCS51/DS390 - use Bank1 for parameter passing"}, + /* End of options */ + { 0, NULL } }; /** Table of all unsupported options and help text to display when one @@ -276,12 +259,6 @@ static PORT *_ports[] = #if !OPT_DISABLE_PIC &pic_port, #endif -#if !OPT_DISABLE_I186 - &i186_port, -#endif -#if !OPT_DISABLE_TLCS900H - &tlcs900h_port, -#endif #if !OPT_DISABLE_TININative &tininative_port, #endif @@ -389,6 +366,21 @@ printVersionInfo () ); } +static void +printOptions(const OPTION *optionsTable) +{ + int i; + for (i = 0; optionsTable[i].shortOpt != 0 || optionsTable[i].longOpt != NULL; i++) + { + fprintf(stdout, " %c%c %-20s %s\n", + optionsTable[i].shortOpt !=0 ? '-' : ' ', + optionsTable[i].shortOpt !=0 ? optionsTable[i].shortOpt : ' ', + optionsTable[i].longOpt != NULL ? optionsTable[i].longOpt : "", + optionsTable[i].help != NULL ? optionsTable[i].help : "" + ); + } +} + /*-----------------------------------------------------------------*/ /* printUsage - prints command line syntax */ /*-----------------------------------------------------------------*/ @@ -402,14 +394,17 @@ printUsage () "Options :-\n" ); - for (i = 0; i < LENGTH(optionsTable); i++) { - fprintf(stdout, " %c%c %-20s %s\n", - optionsTable[i].shortOpt !=0 ? '-' : ' ', - optionsTable[i].shortOpt !=0 ? optionsTable[i].shortOpt : ' ', - optionsTable[i].longOpt != NULL ? optionsTable[i].longOpt : "", - optionsTable[i].help != NULL ? optionsTable[i].help : "" - ); - } + printOptions(optionsTable); + + for (i = 0; i < NUM_PORTS; i++) + { + if (_ports[i]->poptions != NULL) + { + fprintf (stdout, "\nSpecial options for the %s port:\n", _ports[i]->target); + printOptions (_ports[i]->poptions); + } + } + exit (0); } @@ -692,6 +687,38 @@ tryHandleUnsupportedOpt(char **argv, int *pi) } } +static bool +scanOptionsTable(const OPTION *optionsTable, char shortOpt, const char *longOpt, char **argv, int *pi) +{ + int i; + for (i = 0; optionsTable[i].shortOpt != 0 || optionsTable[i].longOpt != NULL; i++) + { + if (optionsTable[i].shortOpt == shortOpt || + (longOpt && optionsTable[i].longOpt && + strcmp(optionsTable[i].longOpt, longOpt) == 0)) + { + + // If it is a flag then we can handle it here + if (optionsTable[i].pparameter != NULL) + { + if (optionsTable[i].shortOpt == shortOpt) + { + verifyShortOption(argv[*pi]); + } + + (*optionsTable[i].pparameter)++; + return 1; + } + else { + // Not a flag. Handled manually later. + return 0; + } + } + } + // Didn't find in the table + return 0; +} + static bool tryHandleSimpleOpt(char **argv, int *pi) { @@ -699,7 +726,6 @@ tryHandleSimpleOpt(char **argv, int *pi) { const char *longOpt = ""; char shortOpt = -1; - int i; if (argv[*pi][1] == '-') { @@ -711,32 +737,19 @@ tryHandleSimpleOpt(char **argv, int *pi) shortOpt = argv[*pi][1]; } - for (i = 0; i < LENGTH(optionsTable); i++) - { - if (optionsTable[i].shortOpt == shortOpt || - (longOpt && optionsTable[i].longOpt && - strcmp(optionsTable[i].longOpt, longOpt) == 0)) - { - - // If it is a flag then we can handle it here - if (optionsTable[i].pparameter != NULL) - { - if (optionsTable[i].shortOpt == shortOpt) - { - verifyShortOption(argv[*pi]); - } - - (*optionsTable[i].pparameter)++; - return 1; - } - else { - // Not a flag. Handled manually later. - return 0; - } - } - } - // Didn't find in the table - return 0; + if (scanOptionsTable(optionsTable, shortOpt, longOpt, argv, pi)) + { + return 1; + } + else if (port && port->poptions && + scanOptionsTable(port->poptions, shortOpt, longOpt, argv, pi)) + { + return 1; + } + else + { + return 0; + } } else { diff --git a/src/avr/main.c b/src/avr/main.c index 05b77984..9ce3cd8a 100644 --- a/src/avr/main.c +++ b/src/avr/main.c @@ -203,6 +203,7 @@ PORT avr_port = { "_", _avr_init, _avr_parseOptions, + NULL, _avr_finaliseOptions, _avr_setDefaultOptions, avr_assignRegisters, diff --git a/src/ds390/main.c b/src/ds390/main.c index 57444c80..f6fdd4e0 100644 --- a/src/ds390/main.c +++ b/src/ds390/main.c @@ -381,6 +381,7 @@ PORT ds390_port = "_", _ds390_init, _ds390_parseOptions, + NULL, _ds390_finaliseOptions, _ds390_setDefaultOptions, ds390_assignRegisters, @@ -665,6 +666,7 @@ PORT tininative_port = "", _tininative_init, _ds390_parseOptions, + NULL, _tininative_finaliseOptions, _tininative_setDefaultOptions, ds390_assignRegisters, diff --git a/src/mcs51/main.c b/src/mcs51/main.c index b3097374..738a7d98 100644 --- a/src/mcs51/main.c +++ b/src/mcs51/main.c @@ -284,6 +284,7 @@ PORT mcs51_port = "_", _mcs51_init, _mcs51_parseOptions, + NULL, _mcs51_finaliseOptions, _mcs51_setDefaultOptions, mcs51_assignRegisters, diff --git a/src/pic/main.c b/src/pic/main.c index d2693844..dd41e64c 100644 --- a/src/pic/main.c +++ b/src/pic/main.c @@ -297,6 +297,7 @@ PORT pic_port = "_", _pic14_init, _pic14_parseOptions, + NULL, _pic14_finaliseOptions, _pic14_setDefaultOptions, pic14_assignRegisters, diff --git a/src/port.h b/src/port.h index 04b02102..5f2643ec 100644 --- a/src/port.h +++ b/src/port.h @@ -6,6 +6,7 @@ #define PORT_INCLUDE #include "SDCCicode.h" +#include "SDCCargs.h" #define TARGET_ID_MCS51 1 #define TARGET_ID_GBZ80 2 @@ -13,8 +14,6 @@ #define TARGET_ID_AVR 4 #define TARGET_ID_DS390 5 #define TARGET_ID_PIC 6 -#define TARGET_ID_I186 7 -#define TARGET_ID_TLCS900H 8 #define TARGET_ID_XA51 9 /* Macro to test the target we are compiling for. @@ -26,8 +25,6 @@ #define TARGET_IS_AVR (port->id==TARGET_ID_AVR) #define TARGET_IS_DS390 (port->id==TARGET_ID_DS390) #define TARGET_IS_PIC (port->id==TARGET_ID_PIC) -#define TARGET_IS_I186 (port->id==TARGET_ID_I186) -#define TARGET_IS_TCLS900H (port->id==TARGET_ID_TCLS900H) #define TARGET_IS_XA51 (port->id==TARGET_ID_XA51) #define MAX_BUILTIN_ARGS 16 @@ -187,6 +184,9 @@ typedef struct void (*init) (void); /** Parses one option + its arguments */ bool (*parseOption) (int *pargc, char **argv, int *i); +/** Optional list of automatically parsed options. Should be + implemented to at least show the help text correctly. */ + OPTION *poptions; /** Called after all the options have been parsed. */ void (*finaliseOptions) (void); /** Called after the port has been selected but before any @@ -278,12 +278,6 @@ extern PORT ds390_port; #if !OPT_DISABLE_PIC extern PORT pic_port; #endif -#if !OPT_DISABLE_I186 -extern PORT i186_port; -#endif -#if !OPT_DISABLE_TLCS900H -extern PORT tlcs900h_port; -#endif #if !OPT_DISABLE_TININative extern PORT tininative_port; #endif diff --git a/src/xa51/main.c b/src/xa51/main.c index 077af218..2972cb4c 100755 --- a/src/xa51/main.c +++ b/src/xa51/main.c @@ -271,6 +271,7 @@ PORT xa51_port = "_", _xa51_init, _xa51_parseOptions, + NULL, _xa51_finaliseOptions, _xa51_setDefaultOptions, xa51_assignRegisters, diff --git a/src/z80/gen.c b/src/z80/gen.c index 826a2cf4..03e5a780 100644 --- a/src/z80/gen.c +++ b/src/z80/gen.c @@ -205,6 +205,13 @@ static struct int pushedBC; int pushedDE; } stack; + + struct + { + int pushedBC; + int pushedDE; + } calleeSaves; + int frameId; int receiveOffset; bool flushStatics; @@ -1026,6 +1033,11 @@ freeAsmop (operand * op, asmop * aaop, iCode * ic) _pop (aop->aopu.aop_pairId); } + if (getPairId (aop) == PAIR_HL) + { + spillPair (PAIR_HL); + } + dealloc: /* all other cases just dealloc */ if (op) @@ -1898,6 +1910,7 @@ movLeft2ResultLong (operand * left, int offl, emit2 ("ld a,%s", aopGet (AOP (left), LSB, FALSE)); emit2 ("ld h,%s", aopGet (AOP (left), MSB16, FALSE)); emit2 ("ld l,a"); + spillPair (PAIR_HL); } else if ( getPairId ( AOP (result)) == PAIR_IY) { @@ -2847,10 +2860,8 @@ genFunction (iCode * ic) symbol *sym = OP_SYMBOL (IC_LEFT (ic)); sym_link *ftype; -#if CALLEE_SAVES bool bcInUse = FALSE; bool deInUse = FALSE; -#endif setArea (IFFUNC_NONBANKED (sym->type)); @@ -2889,9 +2900,13 @@ genFunction (iCode * ic) _G.stack.param_offset = 0; -#if CALLEE_SAVES + if (z80_opts.calleeSavesBC) + { + bcInUse = TRUE; + } + /* Detect which registers are used. */ - if (sym->regsUsed) + if (IFFUNC_CALLEESAVES(sym->type) && sym->regsUsed) { int i; for (i = 0; i < sym->regsUsed->size; i++) @@ -2924,7 +2939,7 @@ genFunction (iCode * ic) _G.stack.param_offset += 2; } - _G.stack.pushedBC = bcInUse; + _G.calleeSaves.pushedBC = bcInUse; if (deInUse) { @@ -2932,8 +2947,7 @@ genFunction (iCode * ic) _G.stack.param_offset += 2; } - _G.stack.pushedDE = deInUse; -#endif + _G.calleeSaves.pushedDE = deInUse; /* adjust the stack for the function */ _G.stack.last = sym->stack; @@ -2979,19 +2993,17 @@ genEndFunction (iCode * ic) emit2 ("!leave"); } -#if CALLEE_SAVES - if (_G.stack.pushedDE) + if (_G.calleeSaves.pushedDE) { emit2 ("pop de"); - _G.stack.pushedDE = FALSE; + _G.calleeSaves.pushedDE = FALSE; } - if (_G.stack.pushedDE) + if (_G.calleeSaves.pushedBC) { emit2 ("pop bc"); - _G.stack.pushedDE = FALSE; + _G.calleeSaves.pushedBC = FALSE; } -#endif if (options.profile) { @@ -5371,9 +5383,12 @@ shiftL2Left2Result (operand * left, int offl, movLeft2Result (left, offl + 1, result, offr + 1, 0); } - if (shCount == 1 && getPairId (AOP (result)) == PAIR_HL) + if (getPairId (AOP (result)) == PAIR_HL) { - emit2 ("add hl,hl"); + while (shCount--) + { + emit2 ("add hl,hl"); + } } else { @@ -5385,34 +5400,56 @@ shiftL2Left2Result (operand * left, int offl, tlbl = newiTempLabel (NULL); tlbl1 = newiTempLabel (NULL); - /* Left is already in result - so now do the shift */ - if (shCount > 1) + if (AOP (result)->type == AOP_REG) { - emit2 ("ld a,!immedbyte+1", shCount); - emit2 ("!shortjp !tlabel", tlbl1->key + 100); - emitLabel (tlbl->key + 100); + while (shCount--) + { + for (offset = 0; offset < size; offset++) + { + l = aopGet (AOP (result), offset, FALSE); + + if (offset == 0) + { + emit2 ("sla %s", l); + } + else + { + emit2 ("rl %s", l); + } + } + } } - - while (size--) + else { - l = aopGet (AOP (result), offset, FALSE); - - if (offset == 0) - { - emit2 ("sla %s", l); - } - else - { - emit2 ("rl %s", l); - } + /* Left is already in result - so now do the shift */ + if (shCount > 1) + { + emit2 ("ld a,!immedbyte+1", shCount); + emit2 ("!shortjp !tlabel", tlbl1->key + 100); + emitLabel (tlbl->key + 100); + } - offset++; - } - if (shCount > 1) - { - emitLabel (tlbl1->key + 100); - emit2 ("dec a"); - emit2 ("!shortjp nz,!tlabel", tlbl->key + 100); + while (size--) + { + l = aopGet (AOP (result), offset, FALSE); + + if (offset == 0) + { + emit2 ("sla %s", l); + } + else + { + emit2 ("rl %s", l); + } + + offset++; + } + if (shCount > 1) + { + emitLabel (tlbl1->key + 100); + emit2 ("dec a"); + emit2 ("!shortjp nz,!tlabel", tlbl->key + 100); + } } } } @@ -6030,6 +6067,7 @@ genGenPointerGet (operand * left, emit2 ("inc hl"); emit2 ("ld h,!*hl"); emit2 ("ld l,a"); + spillPair (PAIR_HL); } else if (getPairId (AOP (left)) == PAIR_HL && !isLastUse (ic, left)) { diff --git a/src/z80/main.c b/src/z80/main.c index 81c9a80b..5389b50c 100644 --- a/src/z80/main.c +++ b/src/z80/main.c @@ -41,6 +41,12 @@ static char _gbz80_defaultRules[] = Z80_OPTS z80_opts; +static OPTION _z80_options[] = + { + { 0, "--callee-saves-bc", &z80_opts.calleeSavesBC, "Force a called function to always save BC" }, + { 0, NULL } + }; + typedef enum { /* Must be first */ @@ -511,6 +517,7 @@ PORT z80_port = "_", _z80_init, _parseOptions, + _z80_options, _finaliseOptions, _setDefaultOptions, z80_assignRegisters, @@ -604,6 +611,7 @@ PORT gbz80_port = "_", _gbz80_init, _parseOptions, + _z80_options, _finaliseOptions, _setDefaultOptions, z80_assignRegisters, diff --git a/src/z80/peeph.def b/src/z80/peeph.def index ee359787..7c48663c 100644 --- a/src/z80/peeph.def +++ b/src/z80/peeph.def @@ -201,3 +201,12 @@ replace { ld e,l ld d,h } +replace { + ld %1,%2 + ld %3,%4 + ld %2,%1 + ld %4,%3 +} by { + ld %1,%2 + ld %3,%4 +} diff --git a/src/z80/ralloc.c b/src/z80/ralloc.c index 9c06bdf4..5cd9ac0f 100644 --- a/src/z80/ralloc.c +++ b/src/z80/ralloc.c @@ -2895,10 +2895,16 @@ packRegisters (eBBlock * ebp) if (!DISABLE_PACK_HL && IS_ITEMP (IC_RESULT (ic))) { + /* PENDING */ if (IS_GB) - packRegsForHLUse (ic); + { + if (0) + packRegsForHLUse (ic); + } else - packRegsForHLUse3 (ic, IC_RESULT (ic), ebp); + { + packRegsForHLUse3 (ic, IC_RESULT (ic), ebp); + } } if (!DISABLE_PACK_IY && IS_ITEMP (IC_RESULT (ic)) && IS_Z80) diff --git a/src/z80/z80.h b/src/z80/z80.h index f34981ec..020dbafb 100644 --- a/src/z80/z80.h +++ b/src/z80/z80.h @@ -15,6 +15,7 @@ Z80_SUB_PORT; typedef struct { Z80_SUB_PORT sub; + int calleeSavesBC; } Z80_OPTS; -- 2.47.2