Stefan Behnel wrote:
> Hi,
> 
> Dag Sverre Seljebotn wrote:
>> *And*, if that is done, there might be a lot of monotone but crucial 
>> work (tear it down and build it up), so we better have a coordinated 
>> coding session with IRC chat. I can put in two or three hours tomorrow.
> 
> It will certainly take longer. I actually don't think there is any good
> default here that ExprNode() could implement, as it now depends on the
> subexpression *if* a temp is needed and on the node itself *when* it needs
> to be allocated and deallocated.
> 
> We'll basically have to re-implement the entire flow that is there inside
> the analyse_expressions() methods, but move it to the code generation. It
> will be easier than doing these things in analyse_expressions(), but it
> certainly needs time to get it right again.

When it comes to implementing a sensible default:

is_temp is already set in analyse_expressions and can just continue to 
be set there (so default needs_target is is_temp).

ExprNode could by default iterate through all subexprs, and if 
needs_target is set, allocate a temp for the result. Then run the code 
generation of the node (which will assume that the result can be copied 
from subexpr.result()), and finally release all the temps.

Then a lot more temps than needed are allocated, but it should produce 
working code. From there on, the extra work put in is about removing 
redundant temps generated on a node-by-node case.

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to