+2002-01-18 Paul Stoffregen <paul@pjrc.com>
+
+ * Added --xram-movc option
+
2002-01-13 Bernhard Held <bernhard@bernhardheld.de>
* support/regression/Makefile: don't include test-mcs51-stack-auto in target all
_divulong.c _fs2schar.c _fs2sint.c _fs2slong.c \
_fs2uchar.c _fs2uint.c _fs2ulong.c _fsadd.c \
_fsdiv.c _fseq.c _fsgt.c _fslt.c _fsmul.c \
- _fsneq.c _fssub.c _gptrget.c _gptrput.c \
+ _fsneq.c _fssub.c _gptrget.c _gptrgetc.c _gptrput.c \
_sint2fs.c _iscntrl.c _isdigit.c _isgraph.c \
_islower.c _isprint.c _ispunct.c _isspace.c \
_isupper.c _isxdigit.c _slong2fs.c _memcmp.c \
--- /dev/null
+/*-------------------------------------------------------------------------
+
+ _gptrget.c :- get value for a generic pointer (used with --xram-movc)
+
+ Written By - Sandeep Dutta . sandeep.dutta@usa.net (1999)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by the
+ Free Software Foundation; either version 2, or (at your option) any
+ later version.
+
+ This library 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 Library General Public License for more details.
+
+ You should have received a copy of the GNU Library 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!
+-------------------------------------------------------------------------*/
+
+unsigned char _gptrgetc ()
+{
+ _asm
+ ; save values passed
+ xch a,r0
+ push acc
+ ;
+ ; depending on the pointer type acc. to SDCCsymt.h
+ ;
+ mov a,b
+ jz 00001$ ; 0 near
+ dec a
+ jz 00003$ ; 1 far
+ dec a
+ jz 00003$ ; 2 code
+ dec a
+ jz 00004$
+ dec a ; 4 skip generic pointer
+ dec a
+ jz 00001$ ; 5 idata
+ ;
+ ; any other value for type
+ ; return xFF
+ mov a,#0xff
+ sjmp 00005$
+ ;
+ ; Pointer to data space
+ ;
+ 00001$:
+ mov r0,dpl ; use only low order address
+ mov a,@r0
+ sjmp 00005$
+;
+; pointer to xternal data
+; pointer to code area
+;
+ 00003$:
+ ; clr a is already 0
+ movc a,@a+dptr
+ sjmp 00005$
+;
+; pointer to xternal stack
+;
+ 00004$:
+ mov r0,dpl
+ movx a,@r0
+;
+; restore and return
+;
+ 00005$:
+ mov r0,a
+ pop acc
+ xch a,r0
+ _endasm ;
+
+}
_memcpy
_memset
_gptrget
+_gptrgetc
_gptrput
_decdptr
_bp
vprintf
assert
time
-bpx
\ No newline at end of file
+bpx
int cyclomatic; /* print cyclomatic information */
int noOverlay; /* don't overlay local variables & parameters */
int mainreturn; /* issue a return after main */
+ int xram_movc; /* use movc instead of movx to read xram (mcs51) */
int nopeep; /* no peep hole optimization */
int asmpeep; /* pass inline assembler thru peep hole */
int debug; /* generate extra debug info */
{ 0, "--cyclomatic", &options.cyclomatic, NULL },
{ 0, "--nooverlay", &options.noOverlay, NULL },
{ 0, "--main-return", &options.mainreturn, "Issue a return after main()" },
+ { 0, "--xram-movc", &options.xram_movc, "Use movc instead of movx to read xram (xdata)" },
{ 0, "--no-peep", &options.nopeep, "Disable the peephole assembly file optimisation" },
{ 0, "--no-reg-params", &options.noRegParams, "On some ports, disable passing some parameters in registers" },
{ 0, "--peep-asm", &options.asmpeep, NULL },
return (options.model == MODEL_FLAT24);
}
+/*-----------------------------------------------------------------*/
+/* xramMovcOption - check if using movc to read xram */
+/*-----------------------------------------------------------------*/
+FBYNAME (xramMovcOption)
+{
+ return (options.xram_movc && (strcmp(port->target,"mcs51") == 0));
+}
+
/*-----------------------------------------------------------------*/
/* labelInRange - will check to see if label %5 is within range */
/*-----------------------------------------------------------------*/
"24bitMode", flat24bitMode
}
,
+ {
+ "xramMovcOption", xramMovcOption
+ }
+ ,
{
"labelRefCount", labelRefCount
}
mov dptr,#%2
}
+replace {
+ movx a,@dptr
+} by {
+ ; Peephole 232 using movc to read xdata (--xram-movc)
+ clr a
+ movc a,@a+dptr
+} if xramMovcOption
+
+replace {
+ lcall _gptrget
+} by {
+ ; Peephole 233 using _gptrgetc instead of _gptrget (--xram-movc)
+ lcall _gptrgetc
+} if xramMovcOption
+
+
+
-gen.o: gen.c ../SDCCglobl.h ../../sdccconf.h \
- ../../support/Util/SDCCerr.h ../../support/Util/newalloc.h \
- ../common.h ../SDCCmem.h ../SDCCast.h ../SDCCsymt.h ../SDCChasht.h \
- ../SDCCval.h ../SDCCset.h ../SDCCy.h ../SDCCbitv.h ../SDCCicode.h \
- ../SDCClabel.h ../SDCCBBlock.h ../SDCCloop.h ../SDCCcse.h \
- ../SDCCcflow.h ../SDCCdflow.h ../SDCClrange.h ../SDCCptropt.h \
- ../SDCCopt.h ../SDCCglue.h ../SDCCpeeph.h ../asm.h ../port.h ralloc.h \
- gen.h
+gen.o: gen.c ../SDCCglobl.h ../../sdccconf.h ../../support/Util/SDCCerr.h \
+ ../../support/Util/newalloc.h ../common.h ../SDCCmem.h ../SDCCast.h \
+ ../SDCCsymt.h ../SDCChasht.h ../SDCCval.h ../SDCCset.h ../SDCCy.h \
+ ../SDCCbitv.h ../SDCCicode.h ../SDCClabel.h ../SDCCBBlock.h \
+ ../SDCCloop.h ../SDCCcse.h ../SDCCcflow.h ../SDCCdflow.h \
+ ../SDCClrange.h ../SDCCptropt.h ../SDCCopt.h ../SDCCglue.h \
+ ../SDCCpeeph.h ../asm.h ../port.h ralloc.h gen.h
main.o: main.c ../common.h ../SDCCglobl.h ../../sdccconf.h \
- ../../support/Util/SDCCerr.h ../SDCCmem.h ../SDCCast.h ../SDCCsymt.h \
- ../SDCChasht.h ../SDCCval.h ../SDCCset.h ../SDCCy.h ../SDCCbitv.h \
- ../SDCCicode.h ../SDCClabel.h ../SDCCBBlock.h ../SDCCloop.h \
- ../SDCCcse.h ../SDCCcflow.h ../SDCCdflow.h ../SDCClrange.h \
- ../SDCCptropt.h ../SDCCopt.h ../SDCCglue.h ../SDCCpeeph.h ../asm.h \
- ../port.h ../../support/Util/newalloc.h main.h ralloc.h gen.h \
- peeph.rul
+ ../../support/Util/SDCCerr.h ../SDCCmem.h ../SDCCast.h ../SDCCsymt.h \
+ ../SDCChasht.h ../SDCCval.h ../SDCCset.h ../SDCCy.h ../SDCCbitv.h \
+ ../SDCCicode.h ../SDCClabel.h ../SDCCBBlock.h ../SDCCloop.h \
+ ../SDCCcse.h ../SDCCcflow.h ../SDCCdflow.h ../SDCClrange.h \
+ ../SDCCptropt.h ../SDCCopt.h ../SDCCglue.h ../SDCCpeeph.h ../asm.h \
+ ../port.h ../../support/Util/newalloc.h main.h ralloc.h gen.h peeph.rul
ralloc.o: ralloc.c ../common.h ../SDCCglobl.h ../../sdccconf.h \
- ../../support/Util/SDCCerr.h ../SDCCmem.h ../SDCCast.h ../SDCCsymt.h \
- ../SDCChasht.h ../SDCCval.h ../SDCCset.h ../SDCCy.h ../SDCCbitv.h \
- ../SDCCicode.h ../SDCClabel.h ../SDCCBBlock.h ../SDCCloop.h \
- ../SDCCcse.h ../SDCCcflow.h ../SDCCdflow.h ../SDCClrange.h \
- ../SDCCptropt.h ../SDCCopt.h ../SDCCglue.h ../SDCCpeeph.h ../asm.h \
- ../port.h ../../support/Util/newalloc.h ralloc.h gen.h
+ ../../support/Util/SDCCerr.h ../SDCCmem.h ../SDCCast.h ../SDCCsymt.h \
+ ../SDCChasht.h ../SDCCval.h ../SDCCset.h ../SDCCy.h ../SDCCbitv.h \
+ ../SDCCicode.h ../SDCClabel.h ../SDCCBBlock.h ../SDCCloop.h \
+ ../SDCCcse.h ../SDCCcflow.h ../SDCCdflow.h ../SDCClrange.h \
+ ../SDCCptropt.h ../SDCCopt.h ../SDCCglue.h ../SDCCpeeph.h ../asm.h \
+ ../port.h ../../support/Util/newalloc.h ralloc.h gen.h