Commit f3526425 authored by Jonas Fietz's avatar Jonas Fietz
Browse files

Remove code for range_node and bits_node

Remove support for relative ranges and relative bitsets

[r27241]
parent 8c82c6f5
......@@ -37,12 +37,6 @@ enum range_types {
VRP_VARYING /* information can not be derived */
};
enum range_ops {
VRP_NONE, /* range is defined absolute */
VRP_ADD, /* range + range_node are the possible values */
VRP_SUB /* range - range_node are the possible values */
};
/** VRP information */
typedef struct {
int valid; /**< This node has valid vrp information */
......@@ -50,13 +44,8 @@ typedef struct {
0: may be not set, 1: definitely set*/
tarval *bits_not_set; /**< The bits which by analysis are definitely
not set, 1 for may be set, 0: definitely not set */
ir_node *bits_node; /**< The node, from which the rest of the bits
are set */
enum range_types range_type;/**< The range represented by range_top, range_bottom */
tarval *range_bottom, *range_top;
ir_node *range_node; /**< The node to which the range is relative */
enum range_ops range_op; /**< The op which describes the relation
between range_node and range */
} vrp_attr;
/**
......
......@@ -53,10 +53,7 @@ static int vrp_update_node(ir_node *node)
tarval *new_bits_not_set = get_tarval_bad();
tarval *new_range_bottom = get_tarval_bad();
tarval *new_range_top = get_tarval_bad();
ir_node *new_bits_node = NULL;
ir_node *new_range_node = NULL;
enum range_types new_range_type = VRP_UNDEFINED;
enum range_ops new_range_op = VRP_NONE;
int something_changed = 0;
vrp_attr *vrp;
ir_phase *phase;
......@@ -88,29 +85,14 @@ static int vrp_update_node(ir_node *node)
case iro_And: {
vrp_attr *vrp_left, *vrp_right;
ir_node *left, *right;
tarval *tmp_tv;
left = get_And_left(node);
right = get_And_right(node);
vrp_left = phase_get_or_set_irn_data(phase, left);
vrp_right = phase_get_or_set_irn_data(phase, right);
new_bits_set = tarval_and(vrp_left->bits_set, vrp_right->bits_set);
new_bits_not_set = tarval_or(vrp_left->bits_not_set, vrp_right->bits_not_set);
tmp_tv = tarval_not(vrp_left->bits_set);
tmp_tv = tarval_eor(vrp_left->bits_not_set, tmp_tv);
/*check if one of the predecessors is completely determined*/
if (tarval_is_null(tmp_tv)) {
new_bits_node = right;
}
tmp_tv = tarval_not(vrp_right->bits_set);
tmp_tv = tarval_eor(vrp_right->bits_not_set, tmp_tv);
if (tarval_is_null(tmp_tv)) {
new_bits_node = left;
}
break;
}
......@@ -179,7 +161,6 @@ static int vrp_update_node(ir_node *node)
case iro_Or: {
vrp_attr *vrp_left, *vrp_right;
ir_node *left, *right;
tarval *tmp_tv;
left = get_Or_left(node);
right = get_Or_right(node);
......@@ -190,18 +171,6 @@ static int vrp_update_node(ir_node *node)
new_bits_set = tarval_or(vrp_left->bits_set, vrp_right->bits_set);
new_bits_not_set = tarval_and(vrp_left->bits_not_set, vrp_right->bits_not_set);
tmp_tv = tarval_not(vrp_left->bits_set);
tmp_tv = tarval_eor(vrp_left->bits_not_set, tmp_tv);
/*check if one of the predecessors is completely determined*/
if (tarval_is_null(tmp_tv)) {
new_bits_node = right;
}
tmp_tv = tarval_not(vrp_right->bits_set);
tmp_tv = tarval_eor(vrp_right->bits_not_set, tmp_tv);
if (tarval_is_null(tmp_tv)) {
new_bits_node = left;
}
break;
}
......@@ -483,115 +452,63 @@ static int vrp_update_node(ir_node *node)
}
}
if (vrp->bits_node == NULL && new_bits_node != NULL) {
something_changed = 1;
vrp->bits_node = new_bits_node;
}
if (vrp->range_type == VRP_UNDEFINED &&
new_range_type != VRP_UNDEFINED) {
something_changed = 1;
vrp->range_type = new_range_type;
vrp->range_bottom = new_range_bottom;
vrp->range_top = new_range_top;
vrp->range_op = new_range_op;
vrp->range_node = new_range_node;
} else if (vrp->range_type == VRP_RANGE) {
if (new_range_type == VRP_RANGE) {
if ((new_range_node == NULL && vrp->range_node == NULL) ||
(new_range_node == vrp->range_node &&
new_range_op == vrp->range_op)) {
if (tarval_cmp(vrp->range_bottom, new_range_bottom) == pn_Cmp_Lt) {
something_changed = 1;
vrp->range_bottom = new_range_bottom;
}
if (tarval_cmp(vrp->range_top, new_range_top) == pn_Cmp_Gt) {
something_changed = 1;
vrp->range_top = new_range_top;
}
if (tarval_cmp(vrp->range_bottom, new_range_bottom) == pn_Cmp_Lt) {
something_changed = 1;
vrp->range_bottom = new_range_bottom;
}
/* prefer the absolute value*/
if (new_range_node == NULL && vrp->range_node != NULL) {
if (tarval_cmp(vrp->range_top, new_range_top) == pn_Cmp_Gt) {
something_changed = 1;
vrp->range_node = NULL;
vrp->range_top = new_range_top;
vrp->range_bottom = new_range_bottom;
}
}
if (new_range_type == VRP_ANTIRANGE) {
/* if they are overlapping, cut the range.*/
/* TODO: Maybe we can preserve more information here*/
if (new_range_node == NULL && vrp->range_node == NULL) {
if (tarval_cmp(vrp->range_bottom, new_range_top) == pn_Cmp_Gt &&
tarval_cmp(vrp->range_bottom, new_range_bottom) == pn_Cmp_Gt) {
something_changed = 1;
vrp->range_bottom = new_range_top;
} else if (tarval_cmp(vrp->range_top, new_range_bottom) == pn_Cmp_Gt &&
tarval_cmp(vrp->range_top, new_range_top) == pn_Cmp_Lt) {
something_changed = 1;
vrp->range_top = new_range_bottom;
}
/* We can not handle the case where the anti range is in the*/
/* range*/
}
if (tarval_cmp(vrp->range_bottom, new_range_top) == pn_Cmp_Gt &&
tarval_cmp(vrp->range_bottom, new_range_bottom) == pn_Cmp_Gt) {
something_changed = 1;
vrp->range_bottom = new_range_top;
/* prefer the absolute value*/
if (new_range_node == NULL && vrp->range_node != NULL) {
} else if (tarval_cmp(vrp->range_top, new_range_bottom) == pn_Cmp_Gt &&
tarval_cmp(vrp->range_top, new_range_top) == pn_Cmp_Lt) {
something_changed = 1;
vrp->range_node = NULL;
vrp->range_top = new_range_top;
vrp->range_bottom = new_range_bottom;
vrp->range_top = new_range_bottom;
}
/* We can not handle the case where the anti range is in the*/
/* range*/
}
} else if (vrp->range_type == VRP_ANTIRANGE) {
if (new_range_type == VRP_ANTIRANGE) {
if ((new_range_node == NULL && vrp->range_node == NULL) ||
(new_range_node == vrp->range_node &&
new_range_op == vrp->range_op)) {
if (tarval_cmp(vrp->range_bottom, new_range_bottom) == pn_Cmp_Gt) {
something_changed = 1;
vrp->range_bottom = new_range_bottom;
}
if (tarval_cmp(vrp->range_top, new_range_top) == pn_Cmp_Lt) {
something_changed = 1;
vrp->range_top = new_range_top;
}
if (tarval_cmp(vrp->range_bottom, new_range_bottom) == pn_Cmp_Gt) {
something_changed = 1;
vrp->range_bottom = new_range_bottom;
}
/* prefer the absolute value*/
if (new_range_node == NULL && vrp->range_node != NULL) {
if (tarval_cmp(vrp->range_top, new_range_top) == pn_Cmp_Lt) {
something_changed = 1;
vrp->range_node = NULL;
vrp->range_top = new_range_top;
vrp->range_bottom = new_range_bottom;
}
}
if (new_range_type == VRP_RANGE) {
if ((new_range_node == NULL && vrp->range_node == NULL) ||
(new_range_node == vrp->range_node &&
new_range_op == vrp->range_op)) {
if (tarval_cmp(vrp->range_bottom, new_range_top) == pn_Cmp_Gt) {
something_changed = 1;
vrp->range_bottom = new_range_top;
}
if (tarval_cmp(vrp->range_top, new_range_bottom) == pn_Cmp_Lt) {
something_changed = 1;
vrp->range_top = new_range_bottom;
}
if (tarval_cmp(vrp->range_bottom, new_range_top) == pn_Cmp_Gt) {
something_changed = 1;
vrp->range_bottom = new_range_top;
}
/* prefer the absolute value*/
if (new_range_node == NULL && vrp->range_node != NULL) {
if (tarval_cmp(vrp->range_top, new_range_bottom) == pn_Cmp_Lt) {
something_changed = 1;
vrp->range_node = NULL;
vrp->range_top = new_range_top;
vrp->range_bottom = new_range_bottom;
vrp->range_top = new_range_bottom;
}
}
}
......@@ -656,9 +573,6 @@ static void *vrp_init_node(ir_phase *phase, const ir_node *n, void *old)
vrp->range_bottom = get_tarval_bad();
vrp->range_top = get_tarval_bad();
}
vrp->bits_node = NULL;
vrp->range_node = NULL;
vrp->range_op = VRP_NONE;
/* TODO: We might be able to set better vrp info at this time, if this is
* a node which is newly created in an already initalized irg
......
......@@ -1260,11 +1260,6 @@ int dump_vrp_info(FILE *F, ir_node *n)
}
ir_fprintf(F, "bits_set: %T\n", vrp->bits_set);
ir_fprintf(F, "bits_not_set: %T\n", vrp->bits_not_set);
if (vrp->bits_node == NULL) {
fprintf(F, "bits_node: None");
} else {
fprintf(F, "bits_node: #%ld\n", get_irn_node_nr(vrp->bits_node));
}
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment