Re: Optimiser problem

Samuel Tardieu <[email protected]> Fri, 19 Nov 2004 10:02:06 +0000 (UTC)
Newsgroups gmane.comp.lang.forth.picforth
Organization Avian Carrier & Friends
Message-ID <[email protected]>
On 2004-11-18, David McNab <[email protected]> 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