int i, n;
if (get_nodes_block(a) != get_nodes_block(b))
- return NULL;
+ return NULL;
n = get_irn_arity(a);
NEW_ARR_A(void *, res, n);
unsigned ref_bits = get_mode_size_bits(mode);
if (is_Conv(left)) {
- ir_mode *mode = get_irn_mode(left);
- unsigned bits = get_mode_size_bits(mode);
+ ir_mode *lmode = get_irn_mode(left);
+ unsigned bits = get_mode_size_bits(lmode);
if (ref_bits == bits &&
- mode_is_int(mode) &&
- get_mode_arithmetic(mode) == irma_twos_complement) {
+ mode_is_int(lmode) &&
+ get_mode_arithmetic(lmode) == irma_twos_complement) {
ir_node *pre = get_Conv_op(left);
ir_mode *pre_mode = get_irn_mode(pre);
}
if (is_Conv(right)) {
- ir_mode *mode = get_irn_mode(right);
- unsigned bits = get_mode_size_bits(mode);
+ ir_mode *rmode = get_irn_mode(right);
+ unsigned bits = get_mode_size_bits(rmode);
if (ref_bits == bits &&
- mode_is_int(mode) &&
- get_mode_arithmetic(mode) == irma_twos_complement) {
+ mode_is_int(rmode) &&
+ get_mode_arithmetic(rmode) == irma_twos_complement) {
ir_node *pre = get_Conv_op(right);
ir_mode *pre_mode = get_irn_mode(pre);
}
}
}
+
+ /* let address arithmetic use unsigned modes */
+ if (is_Const(right)) {
+ ir_mode *rmode = get_irn_mode(right);
+
+ if (mode_is_signed(rmode) && get_mode_arithmetic(rmode) == irma_twos_complement) {
+ /* convert a AddP(P, *s) into AddP(P, *u) */
+ ir_mode *nm = get_reference_mode_unsigned_eq(mode);
+
+ ir_node *pre = new_r_Conv(current_ir_graph, get_nodes_block(n), right, nm);
+ set_binop_right(n, pre);
+ }
+ }
}
return n;
} /* transform_node_AddSub */
(get_opt_unreachable_code())) {
/* It's a boolean Cond, branching on a boolean constant.
Replace it by a tuple (Bad, Jmp) or (Jmp, Bad) */
- jmp = new_r_Jmp(current_ir_graph, get_nodes_block(n));
+ ir_node *blk = get_nodes_block(n);
+ jmp = new_r_Jmp(current_ir_graph, blk);
turn_into_tuple(n, pn_Cond_max);
if (ta == tarval_b_true) {
set_Tuple_pred(n, pn_Cond_false, new_Bad());
set_Tuple_pred(n, pn_Cond_true, new_Bad());
}
/* We might generate an endless loop, so keep it alive. */
- add_End_keepalive(get_irg_end(current_ir_graph), get_nodes_block(n));
+ add_End_keepalive(get_irg_end(current_ir_graph), blk);
}
return n;
} /* transform_node_Cond */
-typedef ir_node* (*recursive_transform) (ir_node *n);
+/**
+ * Prototype of a recursive transform function
+ * for bitwise distributive transformations.
+ */
+typedef ir_node* (*recursive_transform)(ir_node *n);
/**
* makes use of distributive laws for and, or, eor
n = new_rd_And(dbgi, irg, blk, new_n, c, mode);
} else {
n = exact_copy(a);
- set_irn_n(n, -1, blk);
+ set_nodes_block(n, blk);
set_binop_left(n, new_n);
set_binop_right(n, c);
add_identities(current_ir_graph->value_table, n);
/** Compares the attributes of two Call nodes. */
static int node_cmp_attr_Call(ir_node *a, ir_node *b) {
- return (get_irn_call_attr(a) != get_irn_call_attr(b));
+ return get_irn_call_attr(a) != get_irn_call_attr(b);
} /* node_cmp_attr_Call */
/** Compares the attributes of two Sel nodes. */
get_Store_volatility(b) == volatility_is_volatile);
} /* node_cmp_attr_Store */
+/** Compares two exception attributes */
+static int node_cmp_exception(ir_node *a, ir_node *b) {
+ const except_attr *ea = get_irn_except_attr(a);
+ const except_attr *eb = get_irn_except_attr(b);
+
+ return ea->pin_state != eb->pin_state;
+}
+
+#define node_cmp_attr_Bound node_cmp_exception
+
+/** Compares the attributes of two Div nodes. */
+static int node_cmp_attr_Div(ir_node *a, ir_node *b) {
+ const divmod_attr *ma = get_irn_divmod_attr(a);
+ const divmod_attr *mb = get_irn_divmod_attr(b);
+ return ma->exc.pin_state != mb->exc.pin_state ||
+ ma->res_mode != mb->res_mode ||
+ ma->no_remainder != mb->no_remainder;
+} /* node_cmp_attr_Div */
+
+/** Compares the attributes of two DivMod nodes. */
+static int node_cmp_attr_DivMod(ir_node *a, ir_node *b) {
+ const divmod_attr *ma = get_irn_divmod_attr(a);
+ const divmod_attr *mb = get_irn_divmod_attr(b);
+ return ma->exc.pin_state != mb->exc.pin_state ||
+ ma->res_mode != mb->res_mode;
+} /* node_cmp_attr_DivMod */
+
+/** Compares the attributes of two Mod nodes. */
+static int node_cmp_attr_Mod(ir_node *a, ir_node *b) {
+ const divmod_attr *ma = get_irn_divmod_attr(a);
+ const divmod_attr *mb = get_irn_divmod_attr(b);
+ return ma->exc.pin_state != mb->exc.pin_state ||
+ ma->res_mode != mb->res_mode;
+} /* node_cmp_attr_Mod */
+
+/** Compares the attributes of two Quot nodes. */
+static int node_cmp_attr_Quot(ir_node *a, ir_node *b) {
+ const divmod_attr *ma = get_irn_divmod_attr(a);
+ const divmod_attr *mb = get_irn_divmod_attr(b);
+ return ma->exc.pin_state != mb->exc.pin_state ||
+ ma->res_mode != mb->res_mode;
+} /* node_cmp_attr_Quot */
+
/** Compares the attributes of two Confirm nodes. */
static int node_cmp_attr_Confirm(ir_node *a, ir_node *b) {
return (get_Confirm_cmp(a) != get_Confirm_cmp(b));
CASE(Store);
CASE(Confirm);
CASE(ASM);
+ CASE(Div);
+ CASE(DivMod);
+ CASE(Mod);
+ CASE(Quot);
+ CASE(Bound);
+ /* FIXME CopyB */
default:
/* leave NULL */;
}