On 05/20/2011 08:22 PM, Richard Henderson wrote:
I think it might be clearer to have these two in a structure, rather than two separate arrays. That does waste a bit of memory in padding for 64-bit target, but I think it might clean up the code a bit.
You can use the padding to implement a generation count. O(1) clearing of the array might help performance somewhat. At this point making the arrays static makes sense again, because it allows to bump the generation count at the beginning of tcg_constant_folding (if you put it on the stack you have to zero the state).
It could also help to add a num_copies flag tracking whether a register is a copy of this one. If not, you can avoid processing the output registers in the default case.
That would be something like struct { uint16_t state; uint16_t num_copies; uint32_t gen; tcg_target_ulong val; }; Paolo