- tarval *new_bits_set = get_tarval_bad();
- tarval *new_bits_not_set = get_tarval_bad();
- tarval *new_range_bottom = get_tarval_bad();
- tarval *new_range_top = get_tarval_bad();
+ ir_tarval *new_bits_set = get_tarval_bad();
+ ir_tarval *new_bits_not_set = get_tarval_bad();
+ ir_tarval *new_range_bottom = get_tarval_bad();
+ ir_tarval *new_range_top = get_tarval_bad();
const vrp_attr *vrp_left, *vrp_right;
vrp_left = get_vrp_attr(get_Add_left(node));
vrp_right = get_vrp_attr(get_Add_right(node));
const vrp_attr *vrp_left, *vrp_right;
vrp_left = get_vrp_attr(get_Add_left(node));
vrp_right = get_vrp_attr(get_Add_right(node));
const vrp_attr *vrp_left, *vrp_right;
vrp_left = get_vrp_attr(get_Sub_left(node));
vrp_right = get_vrp_attr(get_Sub_right(node));
const vrp_attr *vrp_left, *vrp_right;
vrp_left = get_vrp_attr(get_Sub_left(node));
vrp_right = get_vrp_attr(get_Sub_right(node));
- tarval *bits_set, *bits_not_set;
- bits_set = tarval_rotl(vrp_left->bits_set, get_Const_tarval(right));
- bits_not_set = tarval_rotl(vrp_left->bits_not_set, get_Const_tarval(right));
+ new_bits_set = tarval_rotl(vrp_left->bits_set, get_Const_tarval(right));
+ new_bits_not_set = tarval_rotl(vrp_left->bits_not_set, get_Const_tarval(right));
new_bits_set = tarval_and(
new_bits_not_set, tarval_convert_to(vrp_pred->bits_set, new_mode));
new_bits_set = tarval_and(
new_bits_not_set, tarval_convert_to(vrp_pred->bits_set, new_mode));
- if (tarval_cmp(vrp_pred->range_top, get_mode_max(new_mode)) == pn_Cmp_Le) {
+ /* Matze: TODO, BUGGY, tarval_cmp never returns ir_relation_less_equal */
+ if (tarval_cmp(vrp_pred->range_top, get_mode_max(new_mode)) == ir_relation_less_equal) {
- if (tarval_cmp(vrp_pred->range_bottom, get_mode_min(new_mode)) == pn_Cmp_Ge) {
+ /* Matze: TODO, BUGGY, tarval_cmp never returns ir_relation_greater_equal */
+ if (tarval_cmp(vrp_pred->range_bottom, get_mode_min(new_mode)) == ir_relation_greater_equal) {
/** @todo: Handle non-Const bounds */
if (is_Const(bound)) {
new_range_type = VRP_ANTIRANGE;
new_range_top = get_Const_tarval(bound);
new_range_bottom = get_Const_tarval(bound);
}
/** @todo: Handle non-Const bounds */
if (is_Const(bound)) {
new_range_type = VRP_ANTIRANGE;
new_range_top = get_Const_tarval(bound);
new_range_bottom = get_Const_tarval(bound);
}
- cmp = tarval_cmp(new_range_top, vrp_pred->range_top);
- if (cmp == pn_Cmp_Lt) {
+ relation = tarval_cmp(new_range_top, vrp_pred->range_top);
+ if (relation == ir_relation_less) {
- cmp = tarval_cmp(new_range_bottom, vrp_pred->range_bottom);
- if (cmp == pn_Cmp_Gt) {
+ relation = tarval_cmp(new_range_bottom, vrp_pred->range_bottom);
+ if (relation == ir_relation_greater) {
/* TODO: Check, if there can be information derived from any of these:
is_Abs(node) is_Alloc(node) is_Anchor(node) is_Borrow(node) is_Bound(node)
/* TODO: Check, if there can be information derived from any of these:
is_Abs(node) is_Alloc(node) is_Anchor(node) is_Borrow(node) is_Bound(node)
- is_CopyB(node) is_Div(node) is_DivMod(node) is_Dummy(node)
- is_End(node) is_EndExcept(node) is_EndReg(node) is_Filter(node) is_Free(node)
+ is_CopyB(node) is_Div(node) is_Dummy(node)
+ is_End(node) is_Free(node)
is_IJmp(node) is_InstOf(node) is_Jmp(node) is_Load(node) is_Minus(node)
is_Mod(node) is_Mul(node) is_Mulh(node) is_Mux(node) is_NoMem(node)
is_IJmp(node) is_InstOf(node) is_Jmp(node) is_Load(node) is_Minus(node)
is_Mod(node) is_Mul(node) is_Mulh(node) is_Mux(node) is_NoMem(node)
is_Raise(node) is_Return(node) is_Sel(node) is_Start(node) is_Store(node)
is_SymConst(node) is_Sync(node) is_Tuple(node)
*/
is_Raise(node) is_Return(node) is_Sel(node) is_Start(node) is_Store(node)
is_SymConst(node) is_Sync(node) is_Tuple(node)
*/
/* Merge the newly calculated values with those that might already exist*/
if (new_bits_set != tarval_bad) {
new_bits_set = tarval_or(new_bits_set, vrp->bits_set);
/* Merge the newly calculated values with those that might already exist*/
if (new_bits_set != tarval_bad) {
new_bits_set = tarval_or(new_bits_set, vrp->bits_set);
if (new_bits_not_set != tarval_bad) {
new_bits_not_set = tarval_and(new_bits_not_set, vrp->bits_not_set);
if (new_bits_not_set != tarval_bad) {
new_bits_not_set = tarval_and(new_bits_not_set, vrp->bits_not_set);
if (new_range_type == VRP_ANTIRANGE) {
/* if they are overlapping, cut the range.*/
/* TODO: Maybe we can preserve more information here*/
if (new_range_type == VRP_ANTIRANGE) {
/* if they are overlapping, cut the range.*/
/* TODO: Maybe we can preserve more information here*/
- if (tarval_cmp(vrp->range_bottom, new_range_top) == pn_Cmp_Gt &&
- tarval_cmp(vrp->range_bottom, new_range_bottom) == pn_Cmp_Gt) {
+ if (tarval_cmp(vrp->range_bottom, new_range_top) == ir_relation_greater &&
+ tarval_cmp(vrp->range_bottom, new_range_bottom) == ir_relation_greater) {
- } else if (tarval_cmp(vrp->range_top, new_range_bottom) == pn_Cmp_Gt &&
- tarval_cmp(vrp->range_top, new_range_top) == pn_Cmp_Lt) {
+ } else if (tarval_cmp(vrp->range_top, new_range_bottom) == ir_relation_greater &&
+ tarval_cmp(vrp->range_top, new_range_top) == ir_relation_less) {
- succ = get_irn_out(n, i);
- if (get_irn_link(succ) == VISITED) {
+ ir_node *succ = get_irn_out(n, i);
+ if (bitset_is_set(env->visited, get_irn_idx(succ))) {
- DBG((env->dbg, LEVEL_2, "initialized node nr: %d\n", get_irn_node_nr(n)));
- assert(old==NULL && "init called for node already initialized");
- vrp = phase_alloc(phase, sizeof(vrp_attr));
+ DBG((dbg, LEVEL_2, "initialized node nr: %d\n", get_irn_node_nr(n)));
+ vrp = (vrp_attr*) phase_alloc(phase, sizeof(vrp_attr));
memset(vrp, 0, sizeof(vrp_attr));
/* Initialize the vrp information to default */
memset(vrp, 0, sizeof(vrp_attr));
/* Initialize the vrp information to default */
assure_irg_outs(irg); /* ensure that out edges are consistent*/
phase = irg_get_phase(irg, PHASE_VRP);
if (phase == NULL) {
/* this is our first run */
phase = new_phase(irg, vrp_init_node);
irg_register_phase(irg, PHASE_VRP, phase);
assure_irg_outs(irg); /* ensure that out edges are consistent*/
phase = irg_get_phase(irg, PHASE_VRP);
if (phase == NULL) {
/* this is our first run */
phase = new_phase(irg, vrp_init_node);
irg_register_phase(irg, PHASE_VRP, phase);
- env = phase_alloc(phase, sizeof(*env));
- FIRM_DBG_REGISTER(env->dbg, "ir.ana.vrp");
+ env = (vrp_env_t*) phase_alloc(phase, sizeof(*env));
irg_walk_graph(irg, NULL, vrp_first_pass, env);
irg_walk_graph(irg, NULL, vrp_first_pass, env);
/* while there are entries in the worklist, continue*/
while (!waitq_empty(env->workqueue)) {
/* while there are entries in the worklist, continue*/
while (!waitq_empty(env->workqueue)) {
if (vrp_update_node(node)) {
/* if something changed, add successors to worklist*/
if (vrp_update_node(node)) {
/* if something changed, add successors to worklist*/
ir_graph_pass_t *set_vrp_pass(const char *name)
{
return def_graph_pass(name ? name : "set_vrp", set_vrp_data);
}
ir_graph_pass_t *set_vrp_pass(const char *name)
{
return def_graph_pass(name ? name : "set_vrp", set_vrp_data);
}
{
vrp_attr *vrp_left, *vrp_right;
vrp_left = vrp_get_info(left);
vrp_right = vrp_get_info(right);
{
vrp_attr *vrp_left, *vrp_right;
vrp_left = vrp_get_info(left);
vrp_right = vrp_get_info(right);
}
}
if (!tarval_is_null(tarval_and(vrp_left->bits_set, tarval_not(vrp_right->bits_not_set))) ||
!tarval_is_null(tarval_and(tarval_not(vrp_left->bits_not_set), vrp_right->bits_set))) {
}
}
if (!tarval_is_null(tarval_and(vrp_left->bits_set, tarval_not(vrp_right->bits_not_set))) ||
!tarval_is_null(tarval_and(tarval_not(vrp_left->bits_not_set), vrp_right->bits_set))) {