aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop-unroll.c
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2010-04-08 15:07:57 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2010-04-08 15:07:57 +0000
commit40ac4f73faa256e049279c1611d47a685ff7f370 (patch)
tree0ebeefa37492fc33063a9f55bc090391a092d0fd /gcc/loop-unroll.c
parent07c60ef701e0fe0c65f0186bd521ee83b6c24c3c (diff)
downloadgcc-40ac4f73faa256e049279c1611d47a685ff7f370.zip
gcc-40ac4f73faa256e049279c1611d47a685ff7f370.tar.gz
gcc-40ac4f73faa256e049279c1611d47a685ff7f370.tar.bz2
Implement target hook for loop unrolling
2010-04-08 Christian Borntraeger <borntraeger@de.ibm.com> Wolfgang Gellerich <gellerich@de.ibm.com> Implement target hook for loop unrolling * target.h (loop_unroll_adjust): Add a new target hook function. * target-def.h (TARGET_LOOP_UNROLL_ADJUST): Likewise. * doc/tm.texi (TARGET_LOOP_UNROLL_ADJUST): Document it. * config/s390/s390.c (TARGET_LOOP_UNROLL_ADJUST): Define it. (s390_loop_unroll_adjust): Implement the new target hook for s390. * loop-unroll.c (decide_unroll_runtime_iterations): Call loop unroll target hook (decide_unroll_stupid): Likewise. Co-Authored-By: Wolfgang Gellerich <gellerich@de.ibm.com> From-SVN: r158132
Diffstat (limited to 'gcc/loop-unroll.c')
-rw-r--r--gcc/loop-unroll.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index 231d12d..8ea449d 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "expr.h"
#include "hashtab.h"
#include "recog.h"
+#include "target.h"
/* This pass performs loop unrolling and peeling. We only perform these
optimizations on innermost loops (with single exception) because
@@ -826,6 +827,9 @@ decide_unroll_runtime_iterations (struct loop *loop, int flags)
if (nunroll > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLL_TIMES))
nunroll = PARAM_VALUE (PARAM_MAX_UNROLL_TIMES);
+ if (targetm.loop_unroll_adjust)
+ nunroll = targetm.loop_unroll_adjust (nunroll, loop);
+
/* Skip big loops. */
if (nunroll <= 1)
{
@@ -1366,6 +1370,9 @@ decide_unroll_stupid (struct loop *loop, int flags)
if (nunroll > (unsigned) PARAM_VALUE (PARAM_MAX_UNROLL_TIMES))
nunroll = PARAM_VALUE (PARAM_MAX_UNROLL_TIMES);
+ if (targetm.loop_unroll_adjust)
+ nunroll = targetm.loop_unroll_adjust (nunroll, loop);
+
/* Skip big loops. */
if (nunroll <= 1)
{