Commit dc6419a8 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

I don't remember what I changed, should be checked in yesterday?

[r214]
parent 779d3781
......@@ -147,7 +147,8 @@ new_r_defaultProj (ir_graph *irg, ir_node *block, ir_node *arg,
{
ir_node *res;
assert((arg->op==op_Cond) && (get_irn_mode(arg->in[1]) == mode_I));
arg->attr.c = fragmentary;
arg->attr.c.kind = fragmentary;
arg->attr.c.default_proj = max_proj;
res = new_r_Proj (irg, block, arg, mode_X, max_proj);
return res;
}
......@@ -408,7 +409,8 @@ new_r_Cond (ir_graph *irg, ir_node *block, ir_node *c)
ir_node *in[1] = {c};
ir_node *res;
res = new_ir_node (irg, block, op_Cond, mode_T, 1, in);
res->attr.c = dense;
res->attr.c.kind = dense;
res->attr.c.default_proj = 0;
res = optimize (res);
irn_vrfy (res);
return res;
......@@ -1305,7 +1307,8 @@ new_defaultProj (ir_node *arg, long max_proj)
{
ir_node *res;
assert((arg->op==op_Cond) && (get_irn_mode(arg->in[1]) == mode_I));
arg->attr.c = fragmentary;
arg->attr.c.kind = fragmentary;
arg->attr.c.default_proj = max_proj;
res = new_Proj (arg, mode_X, max_proj);
return res;
}
......
......@@ -154,8 +154,8 @@ inline void set_Block_graph_arr (ir_node *node, int pos, ir_node *value);
exists. Else it passes control along output n (even if this Proj does not
exist.) This Cond we call "fragmentary". There is a special constructor
new_defaultProj that automatically sets the flavor.
The two switch flavors are distinguished by a flag of type cond_kind. Default
flavor is "dense"
The two switch flavors are distinguished by a flag of type cond_kind.
Default flavor is "dense"
*/
typedef enum {
dense, /* Default. Missing Proj nodes are dead control flow. */
......
......@@ -22,6 +22,13 @@ typedef struct {
struct ir_node **graph_arr; /* array to store all parameters */
} block_attr;
/* Cond attributes */
typedef struct {
cond_kind kind; /* flavor of Cond */
long default_proj; /* for optimization: biggest Proj number, i.e. the one
used for default. */
} cond_attr;
/* SymConst attributes */
/* This union contains the symbolic information represented by the node */
typedef union type_or_id {
......@@ -50,6 +57,7 @@ typedef struct {
some have more. Their name is 'irnodename_attr' */
typedef union {
block_attr block; /* For Block: Fields needed to construct it */
cond_attr c; /* For Cond. */
struct tarval *con; /* For Const: contains the value of the constant */
symconst_attr i; /* For SymConst. */
sel_attr s; /* For Sel. */
......@@ -57,7 +65,6 @@ typedef union {
long proj; /* For Proj: contains the result position to project */
alloc_attr a; /* For Alloc. */
type *f; /* For Free. */
cond_kind c; /* For Cond. */
int phi0_pos; /* For Phi. Used to remember the value defined by
this Phi node. Needed when the Phi is completed
to call get_r_internal_value to find the
......
......@@ -86,7 +86,7 @@ init_op(void)
op_Start = new_ir_op (iro_Start, id_from_str ("Start", 5), sizeof (block_attr), 1);
op_End = new_ir_op (iro_End, id_from_str ("End", 3), sizeof (block_attr), 1);
op_Jmp = new_ir_op (iro_Jmp, id_from_str ("Jmp", 3), 0, 0);
op_Cond = new_ir_op (iro_Cond, id_from_str ("Cond", 4), sizeof(cond_kind), 1);
op_Cond = new_ir_op (iro_Cond, id_from_str ("Cond", 4), sizeof(cond_attr), 1);
op_Return = new_ir_op (iro_Return, id_from_str ("Return", 6), 0, 1);
op_Raise = new_ir_op (iro_Raise, id_from_str ("Raise", 5), 0, 1);
......
......@@ -707,13 +707,16 @@ transform_node (ir_node *n)
set_irn_link(a, new_r_Jmp(current_ir_graph, get_nodes_Block(n)));
assert(get_irn_op(get_irn_link(a)) == op_Jmp);
n = get_irn_link(a);
} else {
} else {/* Not taken control flow, but be careful with the default! */
if (get_Proj_proj(n) < a->attr.c.default_proj){
/* a never taken branch */
n = new_Bad();
n = new_Bad();
} else {
a->attr.c.default_proj = get_Proj_proj(n);
}
}
}
}
break;
} break;
case iro_Eor: { /* @@@ not tested as boolean Eor not allowed any more. */
a = get_Eor_left(n);
b = get_Eor_right(n);
......
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