[PicForth] question - recycling GPR variables
David McNab
david at rebirthing.co.nz
Wed Nov 17 14:08:14 CET 2004
Hi,
In writing another PicForth driver, I'm in a situation of having to
handle about 8 values simultaneously.
Having them all on the stack is out of the question. Yes, there's now a
'pick' word, but there are no corresponding words to support storing
back to location n in the stack, nor is there anything like rot, -rot,
roll or -roll. Also, PIC architecture forces inefficiencies when
addressing variable locations.
So my only option is to allocate variables for these values, and operate
directly on the variables.
With other HLLs such as C, the compiler avoids a data stack altogether,
and allocates cells in absolute GPR locations instead. It then uses
heuristics to analyse the call tree and recycle these GPRs wherever
possible.
Is there anything like this in PicForth? I'm trying to conserve data
memory, and would prefer not to have 9 GPRs permanently allocated for
just this one driver alone.
--
Cheers
David
More information about the PicForth
mailing list