summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beemithlp.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-10-28 22:35:45 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2016-10-31 08:06:34 +0100
commit37b1db4c7ea68ba8511fda54a9de58e2ac4ba02a (patch)
tree68d1d620acef17461a33208656bcf9713c1c5c0e /ir/be/beemithlp.c
parentac97d7f35172f7d5d268898cbe82b2b9b8322ddf (diff)
be: Factor out code to get the Projs of conditional branches.
Diffstat (limited to 'ir/be/beemithlp.c')
-rw-r--r--ir/be/beemithlp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ir/be/beemithlp.c b/ir/be/beemithlp.c
index 89dc034..658f533 100644
--- a/ir/be/beemithlp.c
+++ b/ir/be/beemithlp.c
@@ -17,6 +17,7 @@
#include "dbginfo.h"
#include "debug.h"
#include "firm_types.h"
+#include "iredges.h"
#include "irnode_t.h"
#include "irop_t.h"
#include "util.h"
@@ -68,3 +69,19 @@ void be_emit_init_cf_links(ir_node **const block_schedule)
prev = block;
}
}
+
+be_cond_branch_projs_t be_get_cond_branch_projs(ir_node const *const node)
+{
+ be_cond_branch_projs_t projs = { NULL, NULL };
+ foreach_out_edge(node, edge) {
+ ir_node *const proj = get_edge_src_irn(edge);
+ unsigned const pn = get_Proj_num(proj);
+ switch (pn) {
+ case pn_Cond_false: projs.f = proj; continue;
+ case pn_Cond_true: projs.t = proj; continue;
+ }
+ panic("invalid Proj for branch");
+ }
+ assert(projs.f && projs.t);
+ return projs;
+}