> What is the correct way to see if a register is used by a call and not > used to e.g. hold the address of the callee? For example, > > 20: %g1:DI=high(`baz') > 22: %g1:DI=[%g1:DI+low(`baz')] > 23: %o0:DI=0x4 > 24: %o0:DI=call [%g1:DI] argc:0 > > In the above code (from the .210.postreload dump of the attached t.c) > insn 23 sets a call arg register for insn 24, and insn 22 loads the > call address. Using sched-deps, my analysis causes both insns to be > candidates to fill the delay slot of insn 24 (see attached DOT file, > region 5), but that's obviously not correct. In reorg.c's delay slot > scheduling, it somehow knows that insn 23 can fill the delay slot of > insn 24 while insn 22 cannot.
resource.c:mark_referenced_resources<CALL_INSN>. If include_delayed_effects is true, the USEs in CALL_INSN_FUNCTION_USAGE are taken into account; if it is false, they are not. Then mark_referenced_resources is called with true or false from reorg.c depending on the context. > How can I tell whether an insn "only" sets a call arg register, and is > otherwise permutable with the call insn itself? You need to parse CALL_INSN_FUNCTION_USAGE. -- Eric Botcazou