+/**
+ * Post-walker: fix Add and Sub nodes that where results of I<->P conversions.
+ */
+static void fix_adds_and_subs(ir_node *irn, void *ctx) {
+ if (is_Add(irn)) {
+ ir_mode *mode = get_irn_mode(irn);
+
+ if (mode_is_int(mode)) {
+ ir_node *pred;
+
+ pred = get_Add_left(irn);
+ if (get_irn_mode(pred) != mode) {
+ ir_node *block = get_nodes_block(pred);
+
+ pred = new_r_Conv(current_ir_graph, block, pred, mode);
+ set_Add_left(irn, pred);
+ }
+ pred = get_Add_right(irn);
+ if (get_irn_mode(pred) != mode) {
+ ir_node *block = get_nodes_block(pred);
+
+ pred = new_r_Conv(current_ir_graph, block, pred, mode);
+ set_Add_right(irn, pred);
+ }
+ }
+ } else if (is_Sub(irn)) {
+ ir_mode *mode = get_irn_mode(irn);
+
+ if (mode_is_int(mode)) {
+ ir_node *left = get_Sub_left(irn);
+ ir_node *right = get_Sub_right(irn);
+ ir_mode *l_mode = get_irn_mode(left);
+ ir_mode *r_mode = get_irn_mode(right);
+
+ if (mode_is_int(l_mode) && mode_is_int(r_mode)) {
+ if (l_mode != mode) {
+ ir_node *block = get_nodes_block(left);
+
+ left = new_r_Conv(current_ir_graph, block, left, mode);
+ set_Sub_left(irn, left);
+ }
+ if (r_mode != mode) {
+ ir_node *block = get_nodes_block(right);
+
+ right = new_r_Conv(current_ir_graph, block, right, mode);
+ set_Sub_right(irn, right);
+ }
+ }
+ }
+ }
+} /* fix_adds_and_subs */
+
+/* Performs Operator Strength Reduction for the passed graph. */
+void opt_osr(ir_graph *irg, unsigned flags) {