On Thu, Jun 2, 2016 at 6:53 PM, James Greenhalgh <james.greenha...@arm.com> wrote: > > Hi, > > This patch introduces a new target hook, to be used like BRANCH_COST but > with a guaranteed unit of measurement. We want this to break away from > the current ambiguous uses of BRANCH_COST. > > BRANCH_COST is used in ifcvt.c in two types of comparisons. One against > instruction counts - where it is used as the limit on the number of new > instructions we are permitted to generate. The other (after multiplying > by COSTS_N_INSNS (1)) directly against RTX costs. > > Of these, a comparison against RTX costs is the more easily understood > metric across the compiler, and the one I've pulled out to the new hook. > To keep things consistent for targets which don't migrate, this new hook > has a default value of BRANCH_COST * COSTS_N_INSNS (1). > > OK?
How does the caller compute "predictable"? There are some archs where an information on whether this is a forward or backward jump is more useful I guess. Also at least for !speed_p the distance of the branch is important given not all targets support arbitrary branch offsets. I remember that at the last Cauldron we discussed to change things to compare costs of sequences of instructions rather than giving targets no context with just asking for single (sub-)insn rtx costs. That said, the patch is certainly an improvement. Thanks, Richard. > Thanks, > James > > --- > 2016-06-02 James Greenhalgh <james.greenha...@arm.com> > > * target.def (rtx_branch_cost): New. > * doc/tm.texi.in (TARGET_RTX_BRANCH_COST): Document it. > * doc/tm.texi: Regenerate. > * targhooks.h (default_rtx_branch_cost): New. > * targhooks.c (default_rtx_branch_cost): New.