OK, temps in CCodeWriter is now available in -dagss. (As for status, it 
was Greg's idea, Robert seemed to approve and I haven't heard anything 
from Stefan on it but he hasn't opposed it either.) Temps created during 
code generation live in another namespace than temps created during 
analysis, the two don't overlap.

Example:
         tmp = code.func.allocate_temp(PyrexTypes.c_int_type)
         code.putln('%s = %s;' % (tmp, ...))
....
         code.func.release_temp(tmp)

The reason I want "code.func" is to make it explicit that this belongs 
to a seperate function context that is a) *not* given on to created 
insertion_points (there would be no way of having this always work), b) 
must be allocated using code.enter/exit_cfunc_scope.

I.e

b = code.insertion_point()
b.func.allocate_temp(...) # will raise error, b.func is None

(In FuncDefNode.generate_function_definition I then have:
tempvardecl_code = code.insertion_point()
... do everything that will allocat temps on code ...
tempvardecl_code.put_temp_declarations(code.func)
)

Labels also live in code.func but I've created backwards-compatible 
redirectors for those so no code needs to change.

I won't do any actual result_code refactoring at this stage as I don't 
need it, though it is a natural next step. First one should try to merge 
in Greg's work.

I think this is stable for a pull as well -- I'll just start to mark the 
latest stable revision on my status wiki page.

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

Reply via email to