Commit a054cc32 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

ia32: Add peephole optimization 'lea (%b), %d' -> 'mov %b, %d'.

parent ab4368f4
......@@ -17,6 +17,7 @@ libFirm 1.22.1 (2016-01-07)
* Add peephole optimization 'lea c(%r), %r' -> 'add $c, %r' (amd64)
* Add peephole optimization 'lea (%r1, %r2), %r1' -> 'add %r2, %r1' and the commutated case (amd64)
* Add peephole optimization 'lea c(, %i, 2), %d' -> 'lea c(%i, %i), %d' (ia32)
* Add peephole optimization 'lea (%b), %d' -> 'mov %b, %d' (ia32)
* Bugfixes
libFirm 1.22.0 (2015-12-31)
......
......@@ -913,6 +913,14 @@ static void peephole_ia32_Lea(ir_node *node)
ir_node *const amt = ia32_create_Immediate(irg, scale);
res = new_bd_ia32_Shl(dbgi, block, idx, amt);
goto exchange;
} else if (breg && !ireg) {
/* lea (%b), %d -> mov %b, %d */
dbg_info *const dbgi = get_irn_dbg_info(node);
ir_node *const block = get_nodes_block(node);
res = be_new_d_Copy(dbgi, block, base);
arch_set_irn_register(res, oreg);
be_peephole_replace(node, res);
return;
} else if (breg == oreg && ireg && scale == 0) {
/* lea (%b, %i), %b -> add %i, %b */
res = make_add(node, base, idx);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment