* src/SDCCicode.c (geniCodeLogic): made it static,
(geniCodeLogicAndOr): added in order to fix bug #905492,
(ast2iCode): fixed bug #905492
* support/regression/tests/bug-905492.c: added
bernhardheld [Tue, 23 Mar 2004 13:05:10 +0000 (13:05 +0000)]
* src/SDCCast.c (resultTypePropagate, decorateType): avoid promotion to int for complement if possible
* src/SDCCval.c (valComplement),
* src/SDCCicode.c (operandOperation): fixed complement of literal
* support/regression/tests/onebyte.c (testComplement): added
bernhardheld [Mon, 22 Mar 2004 20:29:18 +0000 (20:29 +0000)]
* src/SDCCast.c (processParms): fixed bug #920866; decorateType() can return an optimized tree; actually replace actParm with the new tree
* src/SDCCast.h: added some parantheses to remove side effects
* support/regression/tests/bug-920866.c
epetrich [Fri, 19 Mar 2004 07:37:37 +0000 (07:37 +0000)]
* src/mcs51/gen.c (pushSide, genSignedRightShift, genDjnz, geniPush):
use MOVA macro to avoid "mov a,acc" when peephole optimizer is
disabled (fixes bug #916294)
* sim/ucsim/s51.src/mov.cc (inst_mov_a_addr): Throw an error on
"mov a,acc"; patch provided by Lenny Story
* device/include/mc68hc908gp32.h: header contibuted by Juan Gonzalez
epetrich [Fri, 19 Mar 2004 06:26:43 +0000 (06:26 +0000)]
* src/mcs51/gen.c (genFunction): optimize RECEIVE in reentrant
functions
* src/ds390/gen.c (genFunction, genEndFunction),
* src/ds390/ralloc.c (ds390_assignRegisters),
* src/mcs51/gen.c (genFunction, genEndFunction, mcs51_assignRegisters):
* src/mcs51/ralloc.c (mcs51_assignRegisters): Skip optimizing registers
pushed if there are parameters passed on the stack. Also, a cleaner
way to decide if r0/r1 should be pushed/popped. (Together they fix
bug #918693)
epetrich [Thu, 18 Mar 2004 15:19:30 +0000 (15:19 +0000)]
* doc/sdccman.lyx,
* device/lib/mcs51/crtpagesfr.asm,
* device/lib/mcs51/crtxinit.asm,
* device/lib/mcs51/crtxstack.asm: Changed name of _PAGESFR to _XPAGE
to avoid confusion with Si Lab's SFRPAGE register.
epetrich [Wed, 17 Mar 2004 23:33:26 +0000 (23:33 +0000)]
* src/SDCCglue.c (emitMaps): allow public sfr variables
* src/SDCCglue.c (initialComments): include compiler build date
with compiler version and put the timestamp of the generated
assembly file on a serperate line to be less confusing.
* src/port.h: added genInitStartup hook
* src/avr/main.c,
* src/ds390/main.c,
* src/hc08/main.c,
* src/pic/main.c,
* src/pic16/main.c,
* src/xa51/main.c,
* src/z80/main.c: genInitStartup initialize as NULL (default to
historical behaviour)
* src/SDCCglue.c (glue): _sdcc_gsinit_startup is now port specific.
* src/mcs51/main.c: (_mcs51_genInitStartup, _mcs51_genExtraAreas,
_mcs51_genXINIT, _mcs51_genRAMCLEAR): link initialization code from the
library instead of hard coding it into the compiler.
* support/regression/ports/mcs51-stack-auto/spec.mk,
* src/SDCCmain.c (linkEdit): added mcs51.lib to the link libraries
* device/lib/mcs51/Makefile,
* device/lib/small/Makefile,
* device/lib/large/Makefile,
* device/lib/mcs51/crtpagesfr.asm,
* device/lib/mcs51/crtstart.asm,
* device/lib/mcs51/crtxclear.asm,
* device/lib/mcs51/crtxinit.asm,
* device/lib/mcs51/crtclear.asm,
* device/lib/mcs51/crtxstack.asm: move most of the mcs51 C runtime
startup/initialization out of src/SDCCglue.c and src/mcs51/main.c
and into user configurable files.
* device/lib/clean.mk: clean mcs51 directory too
* support/regression/tests/longlit.c: added static to T1 declaration
* doc/sdccman.lyx: documented _PAGESFR sfr for customizing pdata
accesses in the initialization code
epetrich [Sun, 14 Mar 2004 08:01:28 +0000 (08:01 +0000)]
* src/SDCCloop.c (basicInduction): fixed bug with loop induction
in loops with multiple exits (reported as incorrect registers
used by Martin Helmling in Sdcc-user list)
frief [Fri, 12 Mar 2004 10:34:17 +0000 (10:34 +0000)]
(_ds390_genAssemblerPreamble): cosmetic change, made ds390 register extensions look less like error messages, related to thread "Registers Unknown to Assembler Error" on sdcc-user 2004-03-11
bernhardheld [Tue, 9 Mar 2004 21:36:07 +0000 (21:36 +0000)]
* device/lib/time.c (mktime): fixed bug reported by Bert Thomas
* sdcc.spec: updated and split sdcc into 3 rpms
* src/SDCCast.c (decorateType): &|^ don't need addCast(); addCast() is needed for literals of LEFT_OP and '+'
* src/SDCCicode.c (geniCodeLogic): I must have been braindead when I introduced RESULT_TYPE_NOPROM
* src/SDCCsymt.c (computeType): op is int; added RESULT_TYPE_OTHER; limited promotion to int only for '*'
* src/SDCCsymt.h (computeType): op is int, removed RESULT_TYPE_NOPROM
bernhardheld [Sun, 7 Mar 2004 21:38:02 +0000 (21:38 +0000)]
* src/SDCCast.c (addCast): fixed bug #908454 by promoting bits to char
* src/SDCCicode.c (usualBinaryConversions): op needs int type
(geniCodeCast): cosmetic, don't preserve bit storage class
(geniCodeLeftShift): added promotion
(geniCodeLogic): fixed regression
* src/SDCCsymt.c (computeTypeOr): accept bits too
(compareType): 2nd part of fix for bug #908454, needed for bitfields
vrokas [Sat, 6 Mar 2004 12:39:10 +0000 (12:39 +0000)]
]
* src/pic16/ralloc.c (pic16_genPackRegisters): reverted to old
version of pic16_genPackRegisters which does not check if ic is a
CAST operator,
* src/pic16/gen.c (ifxForOp): disabled new and untested code in
function cause string1.c regression test fails
vrokas [Fri, 5 Mar 2004 15:49:01 +0000 (15:49 +0000)]
* src/pic16/device.c: added some debug lines enabled
with macro DEBUG_CHECK,
* src/pic16/genarith.c: more debug in genPlus,
* (pic16_genUMult8XLit_16, pic16_genUMult8X8_16): removed,
* (pic16_genUMult16X16_16, pic16_genUMult16XLit_16): NEW,
* src/pic16/gen.c: added prototypes for pic16_genMult16X16_16,
* (aopForSym): onStack symbols are re-placed in data memspace,
and onStack flag is cleared,
* (pic16_popGetTempReg, pic16_popReleaseTempReg): modified to
copy temporary pcodeop,
* (genPcall): added warning for not updating PCLATU,
* (genFunction): removed test with IFFUNC_CALLEESAVES, its
always true for pic16 port,
* (genMultOneWord): NEW, supports integer multiplication,
* (genMult): modified to call genMultOneWord,
* (ifxForOp): added warning when return NULL,
* src/pic16/glue.c (pic16emitRegularMap): symbol implicit
flag is set before call to operandFromSymbol for implicit
added structures,
* src/pic16/main.c (_pic16_finaliseOptions): options.float_rent,
options.intlong_rent are set by default,
* (_hasNativeMulFor): modified to allow port generation of integer
multiplication,
* src/pic16/ralloc.c (pic16_allocDirReg): commented out line which
set regtype to REG_SFR for all registers, restricting seting the
accessBank flag for registers 0<= r < 0x80 and 0xf80<=r<=0xfff,
vrokas [Tue, 2 Mar 2004 13:50:29 +0000 (13:50 +0000)]
* src/pic16/device.c (checkAddSym): NEW, adds a symbol to set while
checking if symbol is already in set,
* src/pic16/device.h: prototype for checkAddSym,
* src/pic16/gen.c: (_G): added entry interruptvector,
* (assignResultValue): removed some commented out lines,
* (genFunction): check for ISR via sym->type, absolute section for
interrupt code is created via a new pBlock, the goto instruction is
placed now correctly at the interrupt vector position, changed all
references from ivec to _G.interruptvector,
* WREG,STATUS,BSR are not saved in stack upon an entry to interrupt
is the interrupt is a high priority one, same for return from ISR,
* src/pic16/glue.c: changed all calls of addSetHead for publics and
externs to calls of checkAddSym,
* src/pic16/pcode.c (pic16_pBlockConvert2*): emit warning when
pic16_pcode_verbose flag is set,
* src/pic16/pcode.h: extern to pic16_pcode_verbose,
* src/pic16/pcoderegs.c: message about how many registers are saved
will only be emitted if pic16_pcode_verbose flag is set,
vrokas [Mon, 1 Mar 2004 02:04:17 +0000 (02:04 +0000)]
* src/pic16/device.c (pic16_dump_section): fixed a bug that allowed
the sorting of rlist with NULL elements
* (print_idataType, print_idata): NEW to create idata sections
* src/pic16/device.h: idataSymSet new variable
* src/pic16/gen.c (genFunction): fixed some bugs in string
comparing, improved the aboslute section creation for ISRs,
added FSR0L/FSR0H in registers that are saved in an ISR,
* (genInline): fixed the processing of inline snippets,
now they undergo no process by the peephole optimizer
* src/pic16/glue.c (pic16emitRegularMap): symbols with initialiser
are placed in idataSymSet,
* (pic16emitStaticSeg): extern symbols are added in externs,
* src/pic16/ralloc.c (pic16_allocDirReg): work around to reduce bank
switching when aboslute variables are placed in access bank memory
* (pic16_writeUsedRegs): added call to pic16_dump_idata,
* (packRegsForSupport,packRegsForAccUse,packRegsForOneuse):
commented out with #if,
* (pic16_packRegisters): reintroduce the check for CAST because some
symbols are not correctly handled,
* src/pic16/pcode.h: changed the definition of pCodeAsmDir to hold a
pCodeInstruction instead of pCode,
* src/pic16/pcode.c (pic16_newpCodeAsmDir): modified for the new
pCodeAsmDir definition,
* (pic16_pCode2str, genericPrint): when an AsmDir pcode has a NULL
directive, then the argument directive is emitted without the leading
tab, hack for inline labels which must be in the first column,
* (compareLabel,pic16_findNextInstruction),
* (pic16_findPrevInstruction): added case for PO_ASMDIR,
* (insertBankSwitch): modified for the new pCodeAsmDir,
* src/pic16/gen.c (pic16_popGet): case PO_DIR, adds the offset to
instance,
* (pushSide): commented out with #if,
* (assignResultValue): fixed some typos in saving
registers,
* (genPcall): FIXED and sync'ed with genCall,
* (genDataPointerGet,genDataPointerSet): using offset not leoffset
* (genNearPointerGet): fixed to handle some more cases,
implementation scheme via table reads,
* (genConstPointerGet): modified to access code memory correct,
* (genCodePointerGet,genNearPointerSet,genGenPointerSet): modified
and improved to handle some cases
* glue.c (printIvalType,printIvalChar,emitStaticSeg): use "DB"
instead of "RETLW" for init data
* src/pic16/ralloc.c (pic16_allocDirReg): warning when a symbol is
not IN_DIRSPACE, work around to reduce bank switching when aboslute
variables are placed in access bank memory (<0x80 and >=0xf80),
* src/pic16/pcode.c: added SFRs TBLPTR, TABLAT, added opcodes TBLRD,
TBLRD_POSTINC,TBLRD_POSTDEC,TBLRD_PREINC,TBLWT,TBLWT_POSTINC,
TBLWT_POSTDEC,TBLWT_PREINC
* Fixed initialisation of BSR, set "alias" for SSAVE to "0"
* (pic16_emitDB,pic16_flushDB): New functions to generate "DB"
directives
* (pic16_pCodeConstString): use "DB" instead of "RETLW"
* src/pic16/pcode.h: added TBLRD*,TBLWT*, added pic16_emitDB,
pic16_flushDB, made pic16_newpCodeAsmDir public, added TBLPTR, TABLAT
* src/pic16/ralloc.h: added IDX_BSR,IDX_TBLPTR*,IDX_TABLAT
borutr [Sun, 29 Feb 2004 20:08:39 +0000 (20:08 +0000)]
src/Makefile.in, src/SDCCutil.c, support/Util/findme.c,
support/Util/findme.h, support/Util/system.h: enhance binary relative
search for lib and include by using findProgramPath()
bernhardheld [Thu, 26 Feb 2004 20:51:08 +0000 (20:51 +0000)]
* src/SDCCicode.c (operandOperation): fixed EQ_OP bug, now same as in valCompare(); regression tested in muldiv.c
* support/regression/tests/muldiv.c: mod sign follows dividend only
bernhardheld [Thu, 26 Feb 2004 20:04:51 +0000 (20:04 +0000)]
* src/Makefile.in (dep): include SLIBOBJS in dependency check
* src/SDCCast.c (decorateType): catch another small optimization with '?' operator
* src/SDCCsymt.c (computeType): added comments and cosmetic changes
* src/SDCCval.c (valMult, valDiv, valMod, valPlus, valMinus, valShift): modified to finally use computeType() all over SDCC, see Feature Request #877103
* src/SDCCval.h: cosmetic
vrokas [Fri, 20 Feb 2004 00:48:07 +0000 (00:48 +0000)]
* doc/sdccman.lyx: removed PIC16 from PIC16 Port Specific Options,
removed -penable-stack, added comment for stack pragma, added
warning for not initializing the stack/frame registers, removed
comment at interrupts section
Stack is made permanent, there is no ability to disable stack usage.
* src/pic16/device.h,
* src/pic16/device.c: removed all references to USE_STACK macro,
* src/pic16/device.c (pic16_dump_section): when no elements in
rlist, free rlist before return,
* (pic16_dump_int_registers): NEW, internal registers are a new set
of general purpose registers reused by each function,
* (checkAddReg): returns 1 if registers is added to set,
* (pic16_groupRegistersInSection): when a registers is of type
PO_GPR_TEMP add it in pic16_int_regs and not in pic16_rel_udata,
* src/pic16/device.h: memRange and Assigned Memory are deleted,
SRCASECMP macro is moved here from device.c
* src/pic16/genarith.c (pic16_pCodeOpType): added cases for
PO_PCLATU, PO_PRODL, PO_PRODH,
* (pic16_pCodeOpType, genMinus,
changed compares to "a" register, with AOP_ACC,
* (pic16_genPlus): fixed some bugs and indented properly,
* (pic16_addSign): changed size to size+offset in the MOVWF
instruction,
* (pic16_genUMult8XLit_8): NEW, uses processor MULLW instruction to
multiply 8-bit operand by literal, result is 8-bit,
* (pic16_genUMult8X8_8): NEW, uses processor MULWF instruction to
multiply 2 8-bit operand, result is 8-bit,
* (pic16_genMult8X8_8): modified to call genUMult8X*_8 functions and not
genUMult8X*_16,
* src/pic16/gen.c: changed accUse to contain WREG only,
* (pic16_emitcomment): renamed to pic16_emitpcomment,
* (aopForSym): allocated dir register when IN_DIRSPACE(space) is,
true, do not use immediate addressing any more unless sym is a
pointer in codespace,
* (aopForRemat): do not use immediate addressing when symbol not in
codespace and when symbol's address is requested,
* (aopOp): for-loop in if(sym->accUse) is modified for the new
accUse size (= 1),
* (aopGet): added case for AOP_ACC and don't return "accumulator
bug" but WREG instead,
* (popGetTempReg): pushes contents of temporary register in stack,
* (popReleaseTempReg): pops contents of temporary register from
stack. Use popGetTempReg/popReleaseTempReg in aligned pairs,
* (pic16_popGet): separated case AOP_ACC to return register WREG
from processor registers, AOP_PCODE not checks if pcop is PO_DIR
or PO_IMMEDIATE and initializes their instance/offset appropriately,
* The whole issue with aopForSym,aopForRemat,popGet) is to minimize
the use of immediate pointers to certain cases only.
* (pic16_pushpCodeOpReg, pic16_poppCodeOpReg): use pic16_popGet2p,
* (pic16_loadFromReturn, pic16_storeForReturn: NEW,
* (assignResultValue, genCall, genRet): modified to use the new
function return value scheme with WREG,PRODL,PRODH,FSR0L and FSR0,
genPcall is still broken,
* (genFunction): added code to create 'A' type pBlocks when
interrupt functions are generated, code not extensively tested yet,
ISRs push WREG,STATUS,BSR,PRODL,PRODH,FSR0L,FSR0H registers on stack,
* (genEndFunction): modified so ISRs pop stored registers from stack,
* (genMultOneByte): cleanup,
* (AccRsh): added flag andmask, to and result with appropriate mask,
* (genUnpackBits,genPackBits): fixed and can handle bit fields,
* (genDataPointerGet): fixed and reenabled its use,
* (genNearDataPointerGet): bugs fixed,
* (genDataPointerSet): bugs fixed,
* src/pic16/genutils.c: added functions pic16_DumpValue,pic16_DumpAop,
pic16_DumpSymbol, pic16_DumpOp,
* src/pic16/genutils.h: function prototypes for the above functions,
* src/pic16/glue.c: new flags initsfpnt, to initialize stack/frame
pointers,
* (pic16emitRegularMap): many many many improvements, but needs a
major cleanup,
* src/pic16/main.c: enable_stack in pic16_options is removed,
* (_pic16_parseOptions): removed command line options -penable-stack,
* (_process_pragma): emit stack symbol only when stack pragma is
processed,
* src/pic16/pcode.c: pic16_pc_fsr0 is removed, all operations are
redirected to FSR0L/FSR0H pair,
* (pic16_get_op, pic16_get_op2): modifications and improvements,
* (pic16_getRegFromInstruction, pic16_getRegFromInstruction2): added
cases PO_PRODL,PO_PRODH, pic16_getRegFromInstruction2 returns sane
for immediates,
* (insertBankSwitch): modified to handle cases like: (alfa + 1)
* (dumpPicOptype): NEW,
* src/pic16/pcode.h: added PO_PCLATU,PO_PRODL,PO_PRODH in enum,
* src/pic16/pcoderegs.c (pCodeRegMapLiveRangesInFlow): fixed bug
with movff instruction,
* src/pic16/ralloc.c: renamed typeRegWithIdx to pic16_typeRegWithIdx,
added pic16_int_regs, some packRegsFor* functions are commented out,
because produce errors,
* src/pic16/NOTES: minor modifications
bernhardheld [Fri, 13 Feb 2004 21:47:42 +0000 (21:47 +0000)]
* src/SDCCicode.c (usualBinaryConversions): removed pic16 from ports which can't handle SDCC_NEWONEBYTEOPS,
(geniCodeMultiply): removed conversion from mult to shift for pic14 and pic16
bernhardheld [Wed, 11 Feb 2004 21:30:33 +0000 (21:30 +0000)]
* device/lib/_modsint.c,
* device/lib/_modslong.c: sign follows divisor only
* src/hc08/gen.c (genMultOneByte): if result size is 1, signs or signedness can be ignored
* src/SDCCast.c (addCast): cosmetic - added lineno to CAST
* src/SDCCast.c (resultTypePropagate): added even more ops: +, - and *, added optimization for IFX,
(decorateType): Mult/Div/ModOneByte ops can handle all kind of signed arguments;
reenabled optimization for IFX, which was removed on 2004-01-11
* src/SDCCast.h: added return type IFX
* src/SDCCicode.c: Mult/Div/ModOneByte ops can handle all kind of signed arguments with 8 or 16 bit results; pic14 and pic16 ports use old promotion behaviour;
env. var. SDCC_NEWONEBYTEOPS selects the new, SDCC_OLDONEBYTEOPS selects the old behaviour
* src/SDCCsymt.c (computeType): type2 can be NULL (for LEFT_OP);
changed again and commented promotion rule (it's still not perfect)
* src/SDCCval.c (valDiv): promotion no longer necessary
* src/ds390/gen.c (genMultOneByte) (genDivOneByte) (genModOneByte),
* src/mcs51/gen.c (genMultOneByte) (genDivOneByte) (genModOneByte): rewritten
* support/regression/tests/onebyte.c: added
vrokas [Tue, 10 Feb 2004 19:19:01 +0000 (19:19 +0000)]
* pcode.c,
* pcode.h,
* ralloc.h: added FSR0L, FSR0H and other missing PIC16 SFR's for
indirect addressing. Marked FSR0 as deprecated
* gen.c (pointerCode): commented out, not needed now
(pic16_popGet2p): new MOVFF helper function
(genGenPointerGet),
(genGenPointerSet): reimplemented with MOVFF and POSTINC0
(shiftRLong): removed duplicate debugging info
frief [Sun, 8 Feb 2004 14:29:30 +0000 (14:29 +0000)]
* device/include/c8051f120.h,c8051f300.h,c8051f310.h: added/updated header files for
Silicon Laboratories (formerly Cygnal) CPUs. Contributed by Maarten Brock.
* doc/sdccman.lyx: minor changes, recommended diff -Naur and diff -u in new section Submitting patches
epetrich [Sat, 7 Feb 2004 08:21:56 +0000 (08:21 +0000)]
* support/Util/SDCCerr.h,
* support/Util/SDCCerr.c,
* src/SDCCast.c (decorateType, sizeofOp): complain when sizeof is used
with an incomplete type (fixed bug #883734)
* src/SDCCicode.c (geniCodeCast): fixed bug #890510
epetrich [Fri, 6 Feb 2004 06:27:15 +0000 (06:27 +0000)]
* src/SDCCast.c (decorateType),
* src/SDCCicode.c (geniCodeParms, geniCodeCall): fixed bugs in my ANSI
function pointer implementation
* support/regression/tests/funptrs.c: added tests to verify both forms
of function pointers work correctly. Added tests to verify parameters
are passed in the correct order.
vrokas [Fri, 6 Feb 2004 01:54:37 +0000 (01:54 +0000)]
2004-02-06 Vangelis Rokas <vrokas AT otenet.gr>
* device.c (regCompare): registers are sorted by ascending
address and increasing size,
* main.c (_pic16_finaliseOptions): removed the declaration
of compiler macro MCU. Now a macro of the format pic18fxxxx
will be defined from the command line
2004-02-06 Hans-Juergen Dorn <hans.dorn AT apl-landau.de>
patch committed by Vangelis Rokas <vrokas AT otenet.gr>
* pcode.c (pic16initMnemonics): fixed typo in assignment to PCOP_RLNCF
PCOP_RLCF was overwritten!
* gen.c (genSkip) commented out calls to pic16_emitcode,
* (genCmpEQ) fixed "long" compares, only high word did get compared,
* (genlshTwo),
* (genRRC) added debugging info,
* (shiftL2Left2Result) Fixed bug, if offr > offl. Result got
overwritten while shifting,
* (shiftR2Left2Result) Fixed bug, if offr < offl. Result got
overwritten while shifting,
* (AccLsh),
* (AccRsh),
* (shiftLLeftOrResult),
* (shiftRLeftOrResult),
* (shiftRLong),
* (shiftLLong) Implemented with pic16_emitpcode
* (genlshFour) Replaced pic16_aopPut with pic16_emitpcode,
* (genLeftShift) Fixed bug, operand for shift by variable always
was "and"ed with 0x0f,
* (genLeftShiftLiteral),
* (genrshTwo),
* (genRightShiftLiteral) added debugging info,
* (genrshFour) added comment,
* (genRightShift) determined signedness from operand "left"
instead of "result"
epetrich [Wed, 4 Feb 2004 06:26:03 +0000 (06:26 +0000)]
* src/SDCCicode.c (geniCodeParms),
* src/SDCCast.c (decorateType, processParms): support for ANSI-style
function pointers, fixed function pointer bugs #861242 and #861896