aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtlanal.c
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2017-10-09 21:47:08 +0200
committerSegher Boessenkool <segher@gcc.gnu.org>2017-10-09 21:47:08 +0200
commit94105f5c8a20973e49579064e7ae3ac2013117e8 (patch)
tree46d4eeedf16f01b3fe51f63b1b3526fefd6280e6 /gcc/rtlanal.c
parenta6f9eb8d9b3d83cb174c828d36050a0d1b97867c (diff)
downloadgcc-94105f5c8a20973e49579064e7ae3ac2013117e8.zip
gcc-94105f5c8a20973e49579064e7ae3ac2013117e8.tar.gz
gcc-94105f5c8a20973e49579064e7ae3ac2013117e8.tar.bz2
Add targetm.insn_cost hook
This adds a new hook that the insn_cost function uses if a target has implemented it (it uses the old pattern_cost nee insn_rtx_cost if not). * target.def (insn_cost): New hook. * doc/tm.texi.in (TARGET_INSN_COST): New hook. * doc/tm.texi: Regenerate. * rtlanal.c (insn_cost): Use the new hook. From-SVN: r253562
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r--gcc/rtlanal.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index f01eab5..eadf691 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -5329,6 +5329,9 @@ pattern_cost (rtx pat, bool speed)
int
insn_cost (rtx_insn *insn, bool speed)
{
+ if (targetm.insn_cost)
+ return targetm.insn_cost (insn, speed);
+
return pattern_cost (PATTERN (insn), speed);
}