On Tue, Aug 25, 2009 at 12:49 PM, Daniel Ehrenberg<micro...@gmail.com> wrote:
> On register-based architectures (like the PIC18, right?), doing
> everything with a stack is inherently inefficient because of peeks and
> replaces on the top of the stack.

Dan didn't explain this, but a 'peek' is a load of an indexed stack
location, and a 'replace' is a store of an indexed stack location; if
you think of a stack as an array where stack[0] is the top of the
stack, then you just have

peek(x,n): x := stack[n]
replace(x,n): stack[n] := x

Factor's low-level stack optimization pass breaks stack manipulation
down into abstract instructions representing peeks, replaces, and
stack height changes. It attempts to insert as few peeks and replaces
as possible, using a heuristic. When the final code generator
encounters them, it generates moves between memory and registers.

Slava

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to