gnupic@linuxhacker.org

gnupic@linuxhacker.org


Subject: Re: SDCC overoptimizing
From: Scott Dattalo
Date: Fri, 28 Mar 2003 19:12:09 -0800 (PST)

On Sat, 29 Mar 2003, Erik Gustavsson wrote:

> Den 28 Mar 2003 skrev Scott Dattalo:
> > 
> > The PIC Port of SDCC has become stagnant. The bugs you've reported are 
> > known, but they're not being addressed. What's worse is that I don't know 
> > when I'll be returning to SDCC. 
> > 
> 
> That is really a shame. I was really starting to like SDCC,
> but I've already been bitten by another bug (I think).

Yeah it is ashame. I got stuck in a project that I'm having trouble 
digging myself out of. My participation in SDCC, gpsim, and gpasm have 
suffered.

> 
> ;  PORTB=(PORTB&0xf0)|(0x02);
>         MOVLW   0xf0
>         ANDWF   _PORTB,W
>         MOVLW   0x02
>         MOVWF   _PORTB
> 
> Seems to me the second MOVLW should have been a IORLW.
> I was kind of thinking of having a look at the SDCC 
> code myself, but I don't really know where to start...

Yep, that's a bug.


-------

If you want to look at how to fix these things, then you may want to begin 
by looking at the regression tests in src/regression/*

There you can find numerous files for testing various facets of the PIC 
port. If you run 'make', then a series of scripts will fire off to compile 
the regression code and use gpsim to verify that it compiled properly.

In src/pic/pcode.c are a couple of global variables that affect the way 
SDCC will generate code. In particular, if you set 'debug_verbose' to 
true your .asm generated files will contains tons of debug info (like line 
numbers of SDCC responsible for generating the code). 

That's a start.


Scott


gnupic@linuxhacker.org