#include "archop.h"
#include "opt_polymorphy.h"
#include "opt_confirms.h"
+#include "irtools.h"
/* Make types visible to allow most efficient access */
# include "entity_t.h"
*/
static tarval *computed_value_SymConst(ir_node *n)
{
- if ((get_SymConst_kind(n) == symconst_size) &&
- (get_type_state(get_SymConst_type(n))) == layout_fixed)
- return new_tarval_from_long(get_type_size_bytes(get_SymConst_type(n)), get_irn_mode(n));
+ ir_type *type;
+
+ switch (get_SymConst_kind(n)) {
+ case symconst_type_size:
+ type = get_SymConst_type(n);
+ if (get_type_state(type) == layout_fixed)
+ return new_tarval_from_long(get_type_size_bytes(type), get_irn_mode(n));
+ break;
+ case symconst_type_align:
+ type = get_SymConst_type(n);
+ if (get_type_state(type) == layout_fixed)
+ return new_tarval_from_long(get_type_alignment_bytes(type), get_irn_mode(n));
+ break;
+ default:
+ break;
+ }
return tarval_bad;
}
/* Turn Bound into a tuple (mem, bad, idx) */
ir_node *mem = get_Bound_mem(n);
turn_into_tuple(n, pn_Bound_max);
- set_Tuple_pred(n, pn_Bound_M_regular, mem);
- set_Tuple_pred(n, pn_Bound_X_except, new_Bad()); /* no exception */
- set_Tuple_pred(n, pn_Bound_res, idx);
- set_Tuple_pred(n, pn_Bound_M_except, mem);
+ set_Tuple_pred(n, pn_Bound_M, mem);
+ set_Tuple_pred(n, pn_Bound_X_except, new_Bad()); /* no exception */
+ set_Tuple_pred(n, pn_Bound_res, idx);
}
return n;
}
/* Beware of Phi0 */
if (n > 0) {
ir_node *pred = get_irn_n(phi, 0);
- ir_node *bound;
+ ir_node *bound, *new_Phi, *block, **in;
pn_Cmp pnc;
if (! is_Confirm(pred))
bound = get_Confirm_bound(pred);
pnc = get_Confirm_cmp(pred);
+ NEW_ARR_A(ir_node *, in, n);
+ in[0] = get_Confirm_value(pred);
+
for (i = 1; i < n; ++i) {
pred = get_irn_n(phi, i);
get_Confirm_bound(pred) != bound ||
get_Confirm_cmp(pred) != pnc)
return phi;
+ in[i] = get_Confirm_value(pred);
}
- return new_r_Confirm(current_ir_graph, get_irn_n(phi, -1), phi, bound, pnc);
+ /* move the Confirm nodes "behind" the Phi */
+ block = get_irn_n(phi, -1);
+ new_Phi = new_r_Phi(current_ir_graph, block, n, in, get_irn_mode(phi));
+ return new_r_Confirm(current_ir_graph, block, new_Phi, bound, pnc);
}
}
return phi;