aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgloop.c
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-12-07 14:49:54 +0000
committerMichael Matz <matz@gcc.gnu.org>2017-12-07 14:49:54 +0000
commit1cc521f1a824b5913aeda06ebe296de98f2d9453 (patch)
tree906285fc77b9852eb7e207a988b9d0144496c8b1 /gcc/cfgloop.c
parent5a40ae3c3acf7eaabc9599f5701adbd2f6ec607e (diff)
downloadgcc-1cc521f1a824b5913aeda06ebe296de98f2d9453.zip
gcc-1cc521f1a824b5913aeda06ebe296de98f2d9453.tar.gz
gcc-1cc521f1a824b5913aeda06ebe296de98f2d9453.tar.bz2
Add unroll and jam pass
* gimple-loop-jam.c: New file. * Makefile.in (OBJS): Add gimple-loop-jam.o. * common.opt (funroll-and-jam): New option. * opts.c (default_options_table): Add unroll-and-jam at -O3. * params.def (PARAM_UNROLL_JAM_MIN_PERCENT): New param. (PARAM_UNROLL_JAM_MAX_UNROLL): Ditto. * passes.def: Add pass_loop_jam. * timevar.def (TV_LOOP_JAM): Add. * tree-pass.h (make_pass_loop_jam): Declare. * cfgloop.c (flow_loop_tree_node_add): Add AFTER argument. * cfgloop.h (flow_loop_tree_node_add): Adjust declaration. * cfgloopmanip.c (duplicate_loop): Add AFTER argument, adjust call to flow_loop_tree_node_add. (duplicate_subloops, copy_loops_to): Append to sibling list. * cfgloopmanip.h: (duplicate_loop): Adjust declaration. * doc/invoke.texi (-funroll-and-jam): Document new option. (unroll-jam-min-percent, unroll-jam-max-unroll): Document new params. testsuite/ * gcc.dg/unroll-and-jam.c: New test. From-SVN: r255467
Diffstat (limited to 'gcc/cfgloop.c')
-rw-r--r--gcc/cfgloop.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index d82da97..0d8cf1e 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -296,13 +296,25 @@ establish_preds (struct loop *loop, struct loop *father)
/* Add LOOP to the loop hierarchy tree where FATHER is father of the
added loop. If LOOP has some children, take care of that their
- pred field will be initialized correctly. */
+ pred field will be initialized correctly. If AFTER is non-null
+ then it's expected it's a pointer into FATHERs inner sibling
+ list and LOOP is added behind AFTER, otherwise it's added in front
+ of FATHERs siblings. */
void
-flow_loop_tree_node_add (struct loop *father, struct loop *loop)
+flow_loop_tree_node_add (struct loop *father, struct loop *loop,
+ struct loop *after)
{
- loop->next = father->inner;
- father->inner = loop;
+ if (after)
+ {
+ loop->next = after->next;
+ after->next = loop;
+ }
+ else
+ {
+ loop->next = father->inner;
+ father->inner = loop;
+ }
establish_preds (loop, father);
}