Hi, I am working on gcc-4.1.1 and Itanium architecture. Current now I have finished instrumenting ld and st instructions before the second scheduling pass by reserving two global registers at backend. However, in order to enhance the performance (e.g. make the scheduling better), I choose to allocate two registers for each instrumentation instead of using the reserved ones. To identify which registers I can use for each ld and st instruction, I follow the following idea:
For each insn, I compute its live-in and live-out by starting from the basic-block: as we can get the live-in of the basic-block, then, for INSN(N) in the basic-block, (1) live-in[ INSN(N) ] = live-out [ INSN(N-1) ] (2) live-out[ INSN(N) ] = (live-in [ INSN(N) ] U set) -(REG_DEAD U REG_UNUSED) where set is the set of registers set by the insn, and REG_DEAD, REG_UNUSED can be got from the insn notes. Then, R-( live-in[INSN(N)] U live-out[INSN(N)] ) is the set of registers I can use to instrument INSN(N). (here R is a set of registers I specified, for example, all the caller-save global general registers) Am I right? or is there any thing I mis-understand, if any, please point out, thanks! Further, how to identify SET in (1) ? I have found many of the insns just before the second scheduling have only one set in it. If this is hold for all insns, I think I can use the single_set to get SET. Is there any exception for that? thanks again Wu