On 19 May 2013 21:09, Mark Burton <mark.bur...@greensocs.com> wrote: > Note - what I understand by a basic block is something that ends in a > jump/branch of some description. Hence, one thing I think you can say about a > basic block is that each PC value within it is unique. Hence, if I know the > number of basic blocks executed, and the current PC, then I should be able to > re-run to there (assuming a deterministic system of course).
Assuming your rerun is strictly deterministic so you always exit the basic block the same way each time, then yes, this amounts to optimising the "instruction count" by doing it as "X basic blocks then Y instructions". You could actually have this really do the instruction count for you, if you track insns per block at translation time. (There is some fiddling necessary when we take an unexpected exception in the middle of a block due to a load/store fault.) > I'd be interested to know (a) if there is a sensible place for > adding a basic block counter, and (b) if people like this route > better or worse than an instruction counter? I think you're probably best off getting the instruction counter working properly before trying to optimise it... thanks -- PMM