summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beemithlp.c
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2016-02-08 06:09:24 +0100
committerMatthias Braun <matze@braunis.de>2016-02-08 06:09:38 +0100
commitc82b415bdad26e4fd9ba7a4c2921500b6bb31bc7 (patch)
tree52c1b1563dc021516013d2fa65cca11bbc0be292 /ir/be/beemithlp.c
parenta6aacda304195e4097a0fa120baab462abcbaa83 (diff)
be: Merge common emitter code to query jump targets and block schedule
Diffstat (limited to 'ir/be/beemithlp.c')
-rw-r--r--ir/be/beemithlp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/ir/be/beemithlp.c b/ir/be/beemithlp.c
index 918df43..a46d502 100644
--- a/ir/be/beemithlp.c
+++ b/ir/be/beemithlp.c
@@ -50,3 +50,24 @@ void be_emit_pad_comment(void)
/* 34 spaces */
be_emit_string_len(" ", 34 - col);
}
+
+void be_emit_init_cf_links(ir_node **const block_schedule)
+{
+ ir_graph *const irg = get_irn_irg(block_schedule[0]);
+ assert(ir_resources_reserved(irg) & IR_RESOURCE_IRN_LINK);
+
+ ir_node *prev = NULL;
+ for (size_t i = 0, n = ARR_LEN(block_schedule); i < n; ++i) {
+ ir_node *const block = block_schedule[i];
+
+ /* Initialize cfop link */
+ for (unsigned n = get_Block_n_cfgpreds(block); n-- > 0; ) {
+ ir_node *pred = get_Block_cfgpred(block, n);
+ set_irn_link(pred, block);
+ }
+
+ /* initialize pred block links */
+ set_irn_link(block, prev);
+ prev = block;
+ }
+}