summaryrefslogtreecommitdiffhomepage
path: root/ir/be/betranshlp.c
diff options
context:
space:
mode:
authorChristoph Mallon <mallon@cs.uni-saarland.de>2015-04-17 08:11:56 +0200
committerChristoph Mallon <mallon@cs.uni-saarland.de>2015-04-19 09:07:16 +0200
commit94a9f13d6704bffa6bc6dca3d091217b23b25392 (patch)
tree8b5523555c21f93e7ce1405a0d2e6ac3d62b6ad9 /ir/be/betranshlp.c
parentb772ac487d1c0d3692a74de1741b0d3a4a30e675 (diff)
be: Factorise code to skip same-width conversions.
Diffstat (limited to 'ir/be/betranshlp.c')
-rw-r--r--ir/be/betranshlp.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/ir/be/betranshlp.c b/ir/be/betranshlp.c
index 6760c43..b65972a 100644
--- a/ir/be/betranshlp.c
+++ b/ir/be/betranshlp.c
@@ -850,3 +850,25 @@ ir_node *be_skip_downconv(ir_node *node, bool const single_user)
}
return node;
}
+
+ir_node *be_skip_sameconv(ir_node *node)
+{
+ assert(mode_needs_gp_reg(get_irn_mode(node)));
+ for (;;) {
+ if (get_irn_n_edges(node) > 1) {
+ /* we only want to skip the conv when we're the only user
+ * (because this test is used in the context of address-mode selection
+ * and we don't want to use address mode for multiple users) */
+ break;
+ } else if (is_Conv(node)) {
+ ir_node *const op = get_Conv_op(node);
+ ir_mode *const src_mode = get_irn_mode(op);
+ if (!mode_needs_gp_reg(src_mode) || get_mode_size_bits(get_irn_mode(node)) != get_mode_size_bits(src_mode))
+ break;
+ node = op;
+ } else {
+ break;
+ }
+ }
+ return node;
+}