The attached patch implements a suggestion from Helge Deller to optimize profile support. When _mcount is reachable using a pc-relative branch, we can use the delay slot of the branch to compute the selfpc argument of _mcount.
In working on this change, I noticed a couple of problems with the current implementation of hppa_profile_hook. Firstly, the argument point setup on TARGET_64BIT was being done twice - once in hppa_profile_hook and again in the call expander. Secondly, the call frame and 64-bit argument were setup incorrectly in leaf functions. Because of the call to _mcount, we need to reserve stack space for the fixed arguments. Guess there's a reason why most targets do a libcall. The attached change has been tested on hppa-unknown-linux-gnu, hppa64-hp-hpux11.11 and hppa2.0w-hp-hpux11.11. Committed to trunk. Dave -- John David Anglin dave.ang...@bell.net