[PicForth] Re: Optimiser problem

Samuel Tardieu sam at rfc1149.net
Fri Nov 19 11:02:06 CET 2004


On 2004-11-18, David McNab <david at rebirthing.co.nz> wrote:

> I'm trying to write PicForth code which generates subwf instructions, 
> and not having much luck.

I won't regard this as an optimizer problem -- if you want to generate
specific instructions, you have to go to assembly code. PicForth may
change its Forth->assembly generator at any time if it improves
performance, there is no guarantee that the code will stay the same.
Counting on this is dangerous.

>     disallow-optimizations
>         1 v1 -!
>     allow-optimizations
[...]
> I hoped this would generate something like:
>
>     movlw 1
>     subwf v1,f
>
> However, it generates the same as above.

"disallow-optimizations" forbids most optimizations, but some others are
considered as "natural" in code generation and are not removed. I guess
the line is hard to draw between code generation and optimization.

> Any thoughts/ideas on all this?

I think you should really write this routine in assembly ;)

  Sam



More information about the PicForth mailing list