summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorElias Aebi <elias.aebi@student.kit.edu>2018-04-24 12:14:10 +0200
committerJohannes Bucher <johannes.bucher2@student.kit.edu>2019-01-24 17:42:00 +0100
commit38d82567b020c369a04ec510469df7618436e7b7 (patch)
tree34423c57684db1b9052b7b01adcbfd0b2a6da297
parent1b337aeac2a1f2ef508fc88bf680d21842d859fd (diff)
let the unroll factor be determined by a function
-rw-r--r--ir/opt/loop2.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ir/opt/loop2.c b/ir/opt/loop2.c
index 1565519..31ac51c 100644
--- a/ir/opt/loop2.c
+++ b/ir/opt/loop2.c
@@ -223,7 +223,7 @@ static void rewire_block(ir_node *const block, ir_node *const header)
}
}
-static void duplicate_loop(ir_loop *const loop, int factor)
+static void unroll_loop(ir_loop *const loop, int factor)
{
ir_node *const header = get_loop_header(loop);
if (header == NULL)
@@ -256,6 +256,12 @@ static void duplicate_loop(ir_loop *const loop, int factor)
}
}
+static int determine_unroll_factor(ir_loop *const loop)
+{
+ (void)loop;
+ return 2;
+}
+
static void duplicate_innermost_loops(ir_loop *const loop, bool const outermost)
{
bool innermost = true;
@@ -267,8 +273,11 @@ static void duplicate_innermost_loops(ir_loop *const loop, bool const outermost)
innermost = false;
}
}
- if (innermost && !outermost)
- duplicate_loop(loop, 2);
+ if (innermost && !outermost) {
+ int factor = determine_unroll_factor(loop);
+ if (factor)
+ unroll_loop(loop, factor);
+ }
}
void do_loop_unrolling2(ir_graph *const irg)