summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorElias Aebi <elias.aebi@student.kit.edu>2018-06-06 10:46:13 +0200
committerJohannes Bucher <johannes.bucher2@student.kit.edu>2019-01-24 16:18:16 +0100
commit1b7d5a9dfd269d47f0ebd7b918c0cab70662aa46 (patch)
tree565761032f4cb59129f7c25b18e7de43afb5c561
parent7fe18879c73d75f699e86afae03950a18738b019 (diff)
make the unroll factor and the max size configurable
-rw-r--r--src/firm/firm_opt.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/firm/firm_opt.c b/src/firm/firm_opt.c
index 2a15e38..36a5a6d 100644
--- a/src/firm/firm_opt.c
+++ b/src/firm/firm_opt.c
@@ -38,6 +38,8 @@ struct a_firm_opt {
int clone_threshold; /**< The threshold value for procedure cloning. */
unsigned inline_maxsize; /**< Maximum function size for inlining. */
unsigned inline_threshold;/**< Inlining benefice threshold. */
+ unsigned unroll_factor; /**< unroll factor for loop unrolling */
+ unsigned unroll_maxsize; /**< maximum number of nodes in loop */
};
/* dumping options */
@@ -73,6 +75,8 @@ static struct a_firm_opt firm_opt = {
.clone_threshold = DEFAULT_CLONE_THRESHOLD,
.inline_maxsize = 750,
.inline_threshold = 0,
+ .unroll_factor = 1,
+ .unroll_maxsize = 64,
};
/* dumping options */
@@ -343,6 +347,11 @@ static void do_gcse(ir_graph *irg)
set_opt_global_cse(0);
}
+static void do_loop_unrolling2(ir_graph *irg)
+{
+ unroll_loops(irg, firm_opt.unroll_factor, firm_opt.unroll_maxsize);
+}
+
static opt_config_t opts[] = {
#define IRG(a, b, c, d) { OPT_TARGET_IRG, a, .u.transform_irg = b, c, d }
#define IRP(a, b, c, d) { OPT_TARGET_IRP, a, .u.transform_irp = b, c, d }
@@ -847,6 +856,12 @@ int firm_option(const char *const opt)
} else if ((val = strstart(opt, "inline-threshold="))) {
sscanf(val, "%u", &firm_opt.inline_threshold);
return 1;
+ } else if ((val = strstart(opt, "unroll-factor="))) {
+ sscanf(val, "%u", &firm_opt.unroll_factor);
+ return 1;
+ } else if ((val = strstart(opt, "unroll-max-size="))) {
+ sscanf(val, "%u", &firm_opt.unroll_maxsize);
+ return 1;
} else if (streq(opt, "no-opt")) {
disable_all_opts();
return 1;