summaryrefslogtreecommitdiffhomepage
path: root/ir/be/bearch.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2018-08-19 15:34:50 +0200
committerChristoph Mallon <christoph.mallon@gmx.de>2018-08-23 08:57:40 +0200
commit9ecf429e6789137ed7fc5600b439b10ce5be63ae (patch)
treea2dec8de902239ef5b0c20745d36d3e8fbed5e93 /ir/be/bearch.c
parentd64afeba177a8f05379232d90eddcb6534b5bbaa (diff)
be: Factor out code to get an input pos for a given register requirement.
Diffstat (limited to 'ir/be/bearch.c')
-rw-r--r--ir/be/bearch.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ir/be/bearch.c b/ir/be/bearch.c
index b312a2c..0c21b1d 100644
--- a/ir/be/bearch.c
+++ b/ir/be/bearch.c
@@ -180,6 +180,15 @@ arch_register_req_t const *be_create_reg_req(ir_graph *const irg, arch_register_
return req;
}
+int be_get_input_pos_for_req(ir_node const *const irn, arch_register_req_t const *const req)
+{
+ for (int i = 0, n = get_irn_arity(irn); i != n; ++i) {
+ if (arch_get_irn_register_req_in(irn, i) == req)
+ return i;
+ }
+ return -1;
+}
+
BE_REGISTER_MODULE_CONSTRUCTOR(be_init_arch)
void be_init_arch(void)
{