Joep Suijs wrote:

> The first (of probably many) example I came acros was a case of
> checking of two bits within one register (asm is below):
> if ((RCSTA_OERR == TRUE) | (RCSTA_FERR == TRUE)) then

I agree that the optimisation of the JalV2 compiler could be better.
I think I mentioned it before: I have a program for a 16F88 originally 
written in C (cc5x compiler). After I converted it to Jal (without using 
libraries) it became about 40% larger. Now I use the libraries it is 
more than 50% larger. I have sent the C and the Jal versions (incl ASM 
files) to Kyle for comparison.... may keep him busy for some time!


> where 0x11 is just an example - it would be better if it was something like:
> if ((RCSTA & ( OERR | FERR ) != 0)
> )
> This functional same code takes only 6 lines of code.

Right, but this can be done only since *you* know that the bits are in 
the same register. And the compiler could also know (because of address, 
  but when it doesn't look for this type of optimisation....
When looking in the asm listings I see a lot more possible code-size 
savings, but I have no idea how clever the compiler is to see these too! 


> You could argue that 6 bytes is not worth any effort, but I think
> there are a lot of similar situations.

Agreed! (BTW it saves *words*).

> Do you think code size is important enough to look into this and adapt
> the source?

Since the libs should work for all PICs, it can be tricky to implement 
these 'manual' optimisations.  You have to check if it is valid for all 
PICs. In this case it maybe OK, in other cases it may fail.

Regards, Rob.

-- 
Rob Hamerling, Vianen, NL (http://www.robh.nl/)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to