static ir_tarval *computed_value_Const(const ir_node *n)
{
return get_Const_tarval(n);
-} /* computed_value_Const */
+}
/**
* Return the value of a 'sizeof', 'alignof' or 'offsetof' SymConst.
break;
}
return tarval_bad;
-} /* computed_value_SymConst */
+}
/**
* Return the value of an Add.
}
return tarval_bad;
-} /* computed_value_Add */
+}
/**
* Return the value of a Sub.
return tarval_sub(ta, tb, mode);
return tarval_bad;
-} /* computed_value_Sub */
+}
/**
* Return the value of a Carry.
return get_mode_null(m);
}
return tarval_bad;
-} /* computed_value_Carry */
+}
/**
* Return the value of a Borrow.
return get_mode_null(m);
}
return tarval_bad;
-} /* computed_value_Borrow */
+}
/**
* Return the value of an unary Minus.
return tarval_neg(ta);
return tarval_bad;
-} /* computed_value_Minus */
+}
/**
* Return the value of a Mul.
}
}
return tarval_bad;
-} /* computed_value_Mul */
+}
/**
* Return the value of an And.
}
return tarval_bad;
-} /* computed_value_And */
+}
/**
* Return the value of an Or.
return get_mode_all_one(get_irn_mode(n));
}
return tarval_bad;
-} /* computed_value_Or */
+}
/**
* Return the value of an Eor.
return tarval_eor(ta, tb);
}
return tarval_bad;
-} /* computed_value_Eor */
+}
/**
* Return the value of a Not.
return tarval_not(ta);
return tarval_bad;
-} /* computed_value_Not */
+}
/**
* Tests whether a shift shifts more bits than available in the mode
return get_mode_null(get_irn_mode(n));
return tarval_bad;
-} /* computed_value_Shl */
+}
/**
* Return the value of a Shr.
return get_mode_null(get_irn_mode(n));
return tarval_bad;
-} /* computed_value_Shr */
+}
/**
* Return the value of a Shrs.
return tarval_shrs(ta, tb);
}
return tarval_bad;
-} /* computed_value_Shrs */
+}
/**
* Return the value of a Rotl.
return tarval_rotl(ta, tb);
}
return tarval_bad;
-} /* computed_value_Rotl */
+}
bool ir_zero_when_converted(const ir_node *node, ir_mode *dest_mode)
{
return get_mode_null(mode);
return tarval_bad;
-} /* computed_value_Conv */
+}
/**
* Calculate the value of a Mux: can be evaluated, if the
return value_of(v);
}
return tarval_bad;
-} /* computed_value_Mux */
+}
/**
* Calculate the value of a Confirm: can be evaluated,
return tv;
}
return value_of(get_Confirm_value(n));
-} /* computed_value_Confirm */
+}
/**
* gives a (conservative) estimation of possible relation when comparing
if (ta != tarval_bad && tb != tarval_bad)
return tarval_div(ta, tb);
return tarval_bad;
-} /* do_computed_value_Div */
+}
/**
* Calculate the value of an integer Mod of two nodes.
if (ta != tarval_bad && tb != tarval_bad)
return tarval_mod(ta, tb);
return tarval_bad;
-} /* do_computed_value_Mod */
+}
/**
* Return the value of a Proj(Div).
return tarval_bad;
return do_computed_value_Div(get_Proj_pred(n));
-} /* computed_value_Proj_Div */
+}
/**
* Return the value of a Proj(Mod).
return do_computed_value_Mod(get_Mod_left(mod), get_Mod_right(mod));
}
return tarval_bad;
-} /* computed_value_Proj_Mod */
+}
/**
* Return the value of a Proj.
if (n->op->ops.computed_value_Proj != NULL)
return n->op->ops.computed_value_Proj(proj);
return tarval_bad;
-} /* computed_value_Proj */
+}
/**
* If the parameter n can be computed, return its value, else tarval_bad.
if (n->op->ops.computed_value)
return n->op->ops.computed_value(n);
return tarval_bad;
-} /* computed_value */
+}
/**
* Set the default computed_value evaluator in an ir_op_ops.
return ops;
#undef CASE_PROJ
#undef CASE
-} /* firm_set_default_computed_value */
+}
/**
* Optimize operations that are commutative and have neutral 0,
}
return n;
-} /* equivalent_node_neutral_zero */
+}
/**
* Eor is commutative and has neutral 0.
}
}
return n;
-} /* equivalent_node_Add */
+}
/**
* optimize operations that are not commutative but have neutral 0 on left,
DBG_OPT_ALGSIM1(oldn, a, b, n, FS_OPT_NEUTRAL_0);
}
return n;
-} /* equivalent_node_left_zero */
+}
#define equivalent_node_Shl equivalent_node_left_zero
#define equivalent_node_Shr equivalent_node_left_zero
}
}
return n;
-} /* equivalent_node_Sub */
+}
/**
DBG_OPT_ALGSIM2(oldn, pred, n, FS_OPT_IDEM_UNARY);
}
return n;
-} /* equivalent_node_idempotent_unop */
+}
/** Optimize Not(Not(x)) == x. */
#define equivalent_node_Not equivalent_node_idempotent_unop
}
}
return n;
-} /* equivalent_node_Mul */
+}
/**
* Use algebraic simplification a | a = a | 0 = 0 | a = a.
}
return n;
-} /* equivalent_node_Or */
+}
/**
* Optimize a & 0b1...1 = 0b1...1 & a = a & a = (a|X) & a = a.
}
}
return n;
-} /* equivalent_node_And */
+}
/**
* Try to remove useless Conv's:
}
}
return n;
-} /* equivalent_node_Conv */
+}
/**
* - fold Phi-nodes, iff they have only one predecessor except
DBG_OPT_PHI(oldn, n);
}
return n;
-} /* equivalent_node_Phi */
+}
/**
* Optimize Proj(Tuple).
DBG_OPT_TUPLE(oldn, tuple, proj);
return proj;
-} /* equivalent_node_Proj_Tuple */
+}
/**
* Optimize a / 1 = a.
}
}
return proj;
-} /* equivalent_node_Proj_Div */
+}
/**
* Optimize CopyB(mem, x, x) into a Nop.
}
}
return proj;
-} /* equivalent_node_Proj_CopyB */
+}
/**
* Optimize Bounds(idx, idx, upper) into idx.
}
}
return proj;
-} /* equivalent_node_Proj_Bound */
+}
/**
* Does all optimizations on nodes that must be done on its Projs
if (n->op->ops.equivalent_node_Proj)
return n->op->ops.equivalent_node_Proj(proj);
return proj;
-} /* equivalent_node_Proj */
+}
/**
* Remove Id's.
DBG_OPT_ID(oldn, n);
return n;
-} /* equivalent_node_Id */
+}
/**
* Optimize a Mux.
if (n->op->ops.equivalent_node)
return n->op->ops.equivalent_node(n);
return n;
-} /* equivalent_node */
+}
/**
* Sets the default equivalent node operation for an ir_op_ops.
return ops;
#undef CASE
#undef CASE_PROJ
-} /* firm_set_default_equivalent_node */
+}
/**
* Returns non-zero if a node is a Phi node
return 0;
}
return 1;
-} /* is_const_Phi */
+}
typedef ir_tarval *(*tarval_sub_type)(ir_tarval *a, ir_tarval *b, ir_mode *mode);
typedef ir_tarval *(*tarval_binop_type)(ir_tarval *a, ir_tarval *b);
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode);
-} /* apply_binop_on_phi */
+}
/**
* Apply an evaluator on a binop with two constant Phi.
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(a), n, (ir_node **)res, mode);
-} /* apply_binop_on_2_phis */
+}
/**
* Apply an evaluator on a unop with a constant operator (a Phi).
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode);
-} /* apply_unop_on_phi */
+}
/**
* Apply a conversion on a constant operator (a Phi).
res[i] = new_r_Const(irg, (ir_tarval*)res[i]);
}
return new_r_Phi(get_nodes_block(phi), n, (ir_node **)res, mode);
-} /* apply_conv_on_phi */
+}
/**
* Transform AddP(P, ConvIs(Iu)), AddP(P, ConvIu(Is)) and
}
return n;
-} /* transform_node_AddSub */
+}
#define HANDLE_BINOP_PHI(eval, a, b, c, mode) \
do { \
}
return n;
-} /* transform_node_Add */
+}
/**
* returns -cnst or NULL if impossible
}
}
return n;
-} /* transform_node_Sub */
+}
/**
* Several transformation done on n*n=2n bits mul.
}
}
return arch_dep_replace_mul_with_shifts(n);
-} /* transform_node_Mul */
+}
/**
* Transform a Div Node.
set_Tuple_pred(n, pn_Div_res, value);
}
return n;
-} /* transform_node_Div */
+}
/**
* Transform a Mod node.
set_Tuple_pred(n, pn_Mod_res, value);
}
return n;
-} /* transform_node_Mod */
+}
/**
* Transform a Cond node.
clear_irg_state(irg, IR_GRAPH_STATE_NO_UNREACHABLE_CODE);
}
return n;
-} /* transform_node_Cond */
+}
/**
* Prototype of a recursive transform function
n = transform_node_bitop_shift(n);
return n;
-} /* transform_node_And */
+}
/* the order of the values is important! */
typedef enum const_class {
n = transform_node_bitop_shift(n);
return n;
-} /* transform_node_Eor */
+}
/**
* Transform a Not.
}
return n;
-} /* transform_node_Minus */
+}
/**
* Transform a Proj(Load) with a non-null address.
}
}
return proj;
-} /* transform_node_Proj_Load */
+}
/**
* Transform a Proj(Store) with a non-null address.
}
}
return proj;
-} /* transform_node_Proj_Store */
+}
/**
* Transform a Proj(Div) with a non-zero value.
}
}
return proj;
-} /* transform_node_Proj_Div */
+}
/**
* Transform a Proj(Mod) with a non-zero value.
}
}
return proj;
-} /* transform_node_Proj_Mod */
+}
/**
* Optimizes jump tables (CondIs or CondIu) by removing all impossible cases.
left = get_Eor_left(left);
changed = true;
}
- } /* mode_is_int(...) */
+ }
}
/* Cmp(And(1bit, val), 1bit) "bit-testing" can be replaced
}
}
}
- } /* == or != */
- } /* mode_is_int */
+ }
+ }
if (relation == ir_relation_equal || relation == ir_relation_less_greater) {
switch (get_irn_opcode(left)) {
DBG_OPT_ALGSIM0(n, n, FS_OPT_CMP_SHF_TO_AND);
}
break;
- } /* switch */
+ }
}
- } /* tarval != bad */
+ }
}
if (changedc) { /* need a new Const */
}
}
return proj;
-} /* transform_node_Proj_CopyB */
+}
/**
* Optimize Bounds(idx, idx, upper) into idx.
}
}
return proj;
-} /* transform_node_Proj_Bound */
+}
/**
* Does all optimizations on nodes that must be done on its Projs
if (n->op->ops.transform_node_Proj)
return n->op->ops.transform_node_Proj(proj);
return proj;
-} /* transform_node_Proj */
+}
/**
* Test whether a block is unreachable
*a = op_a;
*c = op_b;
}
-} /* get_comm_Binop_Ops */
+}
/**
* Optimize a Or(And(Or(And(v,c4),c3),c2),c1) pattern if possible.
/* check for more */
}
-} /* transform_node_Or_bf_store */
+}
/**
* Optimize an Or(shl(x, c), shr(x, bits - c)) into a Rotl
n = new_r_Rotl(block, x, c1, mode);
DBG_OPT_ALGSIM0(irn_or, n, FS_OPT_OR_SHFT_TO_ROTL);
return n;
-} /* transform_node_Or_Rotl */
+}
static bool is_cmp_unequal(const ir_node *node)
{
}
return n;
-} /* transform_node_Or */
+}
/* forward */
n = transform_node_shift_bitop(n);
return n;
-} /* transform_node_Shr */
+}
/**
* Transform a Shrs.
n = transform_node_shift_bitop(n);
return n;
-} /* transform_node_Shrs */
+}
/**
* Transform a Shl.
n = transform_node_shift_bitop(n);
return n;
-} /* transform_node_Shl */
+}
/**
* Transform a Rotl.
n = transform_node_shift_bitop(n);
return n;
-} /* transform_node_Rotl */
+}
/**
* Transform a Conv.
}
return n;
-} /* transform_node_Conv */
+}
/**
* Remove dead blocks and nodes in dead blocks
if (j != n_keepalives)
set_End_keepalives(n, j, in);
return n;
-} /* transform_node_End */
+}
int ir_is_negated_value(const ir_node *a, const ir_node *b)
{
if (get_irn_pinned(call) == op_pin_state_floats)
set_irn_pinned(res, op_pin_state_floats);
return res;
-} /* transform_node_Call */
+}
/**
* Tries several [inplace] [optimizing] transformations and returns an
} while (oldn != n);
return n;
-} /* transform_node */
+}
/**
* Sets the default transform node operation for an ir_op_ops.
#undef CASE_PROJ_EX
#undef CASE_PROJ
#undef CASE
-} /* firm_set_default_transform_node */
+}
/* **************** Common Subexpression Elimination **************** */
return ops;
#undef CASE
-} /* firm_set_default_node_cmp_attr */
+}
/*
* Compare function for two nodes in the value table. Gets two
return a->op->ops.node_cmp_attr(a, b);
return 0;
-} /* identities_cmp */
+}
/*
* Calculate a hash value of a node.
unsigned ir_node_hash(const ir_node *node)
{
return node->op->ops.hash(node);
-} /* ir_node_hash */
+}
void new_identities(ir_graph *irg)
if (irg->value_table != NULL)
del_pset(irg->value_table);
irg->value_table = new_pset(identities_cmp, N_IR_NODES);
-} /* new_identities */
+}
void del_identities(ir_graph *irg)
{
if (irg->value_table != NULL)
del_pset(irg->value_table);
-} /* del_identities */
+}
/* Normalize a node by putting constants (and operands with larger
* node index) on the right (operator side). */
hook_normalize(n);
}
}
-} /* ir_normalize_node */
+}
/*
* Return the canonical node computing the same value as n.
}
return nn;
-} /* identify_remember */
+}
/**
* During construction we set the op_pin_state_pinned flag in the graph right
set_irg_pinned(irg, op_pin_state_floats);
}
return n;
-} /* identify_cons */
+}
/* Add a node to the identities value table. */
void add_identities(ir_node *node)
visit(node, env);
}
current_ir_graph = rem;
-} /* visit_all_identities */
+}
/**
* These optimizations deallocate nodes from the obstack.
}
return n;
-} /* optimize_node */
+}
/**
}
return n;
-} /* optimize_in_place_2 */
+}
/**
* Wrapper for external use, set proper status bits after optimization.
change the control graph. */
clear_irg_state(irg, IR_GRAPH_STATE_CONSISTENT_DOMINANCE);
return optimize_in_place_2(n);
-} /* optimize_in_place */
+}
/**
* Calculate a hash value of a Const node.
h = HASH_PTR(node->attr.con.tarval);
return h;
-} /* hash_Const */
+}
/**
* Calculate a hash value of a SymConst node.
h = HASH_PTR(node->attr.symc.sym.type_p);
return h;
-} /* hash_SymConst */
+}
/**
* Set the default hash operation in an ir_op_ops.
ops = firm_set_default_get_entity_attr(code, ops);
return ops;
-} /* firm_set_default_operations */
+}