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

implemented Confirm node

[r1912]
parent 071a2588
......@@ -714,6 +714,22 @@ new_rd_Bad (ir_graph *irg)
return irg->bad;
}
INLINE ir_node *
new_rd_Confirm (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *val, ir_node *bound, pn_Cmp cmp)
{
ir_node *in[2], *res;
in[0] = val;
in[1] = bound;
res = new_ir_node (db, irg, block, op_Confirm, get_irn_mode(val), 2, in);
res->attr.confirm_cmp = cmp;
res = optimize_node (res);
irn_vrfy_irg(res, irg);
return res;
}
INLINE ir_node *
new_rd_Unknown (ir_graph *irg)
{
......@@ -2128,7 +2144,7 @@ ir_node *
new_d_Sync (dbg_info* db, int arity, ir_node** in)
{
return new_rd_Sync (db, current_ir_graph, current_ir_graph->current_block,
arity, in);
arity, in);
}
......@@ -2138,6 +2154,13 @@ new_d_Bad (void)
return current_ir_graph->bad;
}
ir_node *
new_d_Confirm (dbg_info *db, ir_node *val, ir_node *bound, pn_Cmp cmp)
{
return new_rd_Confirm (db, current_ir_graph, current_ir_graph->current_block,
val, bound, cmp);
}
ir_node *
new_d_Unknown (void)
{
......@@ -2459,6 +2482,9 @@ ir_node *new_Id (ir_node *val, ir_mode *mode) {
ir_node *new_Bad (void) {
return new_d_Bad();
}
ir_node *new_Confirm (ir_node *val, ir_node *bound, pn_Cmp cmp) {
return new_d_Confirm (NULL, val, bound, cmp);
}
ir_node *new_Unknown(void) {
return new_d_Unknown();
}
......
......@@ -146,13 +146,15 @@ dump_node_opcode (ir_node *n)
char buf[1024];
int res;
/* Const */
if (get_irn_opcode(n) == iro_Const) { res = tarval_snprintf(buf, sizeof(buf), get_Const_tarval(n));
switch(get_irn_opcode(n)) {
case iro_Const: {
res = tarval_snprintf(buf, sizeof(buf), get_Const_tarval(n));
assert(res < sizeof(buf) && "buffer to small for tarval_snprintf");
fprintf(F, buf);
} break;
/* SymConst */
} else if (get_irn_opcode(n) == iro_SymConst) {
case iro_SymConst: {
if (get_SymConst_kind(n) == linkage_ptr_info) {
/* don't use get_SymConst_ptr_info as it mangles the name. */
fprintf (F, "SymC %s", get_id_str(get_SymConst_ptrinfo(n)));
......@@ -165,15 +167,17 @@ dump_node_opcode (ir_node *n)
else
fprintf (F, "size");
}
} break;
/* Filter */
} else if (get_irn_opcode(n) == iro_Filter && !interprocedural_view) {
fprintf(F, "Proj'");
case iro_Filter: {
if (!interprocedural_view) fprintf(F, "Proj'");
} break;
/* all others */
} else {
default: {
fprintf (F, "%s", get_id_str(get_irn_opident(n)));
}
} /* end switch */
}
static INLINE void
......@@ -197,6 +201,7 @@ dump_node_mode (ir_node *n)
case iro_Shr:
case iro_Abs:
case iro_Cmp:
case iro_Confirm:
fprintf (F, "%s", get_mode_name(get_irn_mode(n)));
break;
default:
......@@ -242,6 +247,10 @@ dump_node_nodeattr (ir_node *n)
case iro_Cast: {
fprintf (F, "(%s)", get_type_name(get_Cast_type(n)));
} break;
case iro_Confirm: {
fprintf (F, "%s", get_pnc_string(get_Confirm_cmp(n)));
} break;
default:
;
} /* end switch */
......
......@@ -2126,6 +2126,31 @@ set_Id_pred (ir_node *node, ir_node *pred) {
set_irn_n(node, 0, pred);
}
INLINE ir_node *get_Confirm_value (ir_node *node) {
assert (node->op == op_Confirm);
return get_irn_n(node, 0);
}
INLINE void set_Confirm_value (ir_node *node, ir_node *value) {
assert (node->op == op_Confirm);
set_irn_n(node, 0, value);
}
INLINE ir_node *get_Confirm_bound (ir_node *node) {
assert (node->op == op_Confirm);
return get_irn_n(node, 1);
}
INLINE void set_Confirm_bound (ir_node *node, ir_node *bound) {
assert (node->op == op_Confirm);
set_irn_n(node, 0, bound);
}
INLINE pn_Cmp get_Confirm_cmp (ir_node *node) {
assert (node->op == op_Confirm);
return node->attr.confirm_cmp;
}
INLINE void set_Confirm_cmp (ir_node *node, pn_Cmp cmp) {
assert (node->op == op_Confirm);
node->attr.confirm_cmp = cmp;
}
INLINE ir_node *
get_Filter_pred (ir_node *node) {
......
......@@ -668,6 +668,15 @@ INLINE void set_Tuple_pred (ir_node *node, int pos, ir_node *pred);
INLINE ir_node *get_Id_pred (ir_node *node);
INLINE void set_Id_pred (ir_node *node, ir_node *pred);
/** Confirm has a single result and returns 'value' unchanged.
* The node expresses a restriction on 'value':
* 'value' 'cmp' 'bound' == true. */
INLINE ir_node *get_Confirm_value (ir_node *node);
INLINE void set_Confirm_value (ir_node *node, ir_node *value);
INLINE ir_node *get_Confirm_bound (ir_node *node);
INLINE void set_Confirm_bound (ir_node *node, ir_node *bound);
INLINE pn_Cmp get_Confirm_cmp (ir_node *node);
INLINE void set_Confirm_cmp (ir_node *node, pn_Cmp cmp);
/*
*
......
......@@ -144,6 +144,8 @@ typedef struct {
type *totype;
} cast_attr;
typedef pn_Cmp confirm_attr; /** Attribute to hold compare operation */
/** Some irnodes just have one attribute, these are stored here,
some have more. Their name is 'irnodename_attr' */
typedef union {
......@@ -169,6 +171,7 @@ typedef union {
Field n set to true if pred n is backedge.
@todo Ev. replace by bitfield! */
long proj; /**< For Proj: contains the result position to project */
confirm_attr confirm_cmp; /**< For Confirm: compare operation */
filter_attr filter; /**< For Filter */
end_attr end; /**< For EndReg, EndExcept */
#if PRECISE_EXC_CONTEXT
......
......@@ -70,6 +70,7 @@ ir_op *op_Tuple; ir_op *get_op_Tuple () { return op_Tuple; }
ir_op *op_Proj; ir_op *get_op_Proj () { return op_Proj; }
ir_op *op_Id; ir_op *get_op_Id () { return op_Id; }
ir_op *op_Bad; ir_op *get_op_Bad () { return op_Bad; }
ir_op *op_Confirm; ir_op *get_op_Confirm () { return op_Confirm; }
ir_op *op_Unknown; ir_op *get_op_Unknown () { return op_Unknown; }
ir_op *op_Filter; ir_op *get_op_Filter () { return op_Filter; }
......@@ -146,13 +147,14 @@ init_op(void)
op_Free = new_ir_op (iro_Free, "Free", pinned, 1, sizeof (type *));
op_Sync = new_ir_op (iro_Sync, "Sync", pinned, 0, 0);
op_Proj = new_ir_op (iro_Proj, "Proj", floats, 0, sizeof (long));
op_Tuple = new_ir_op (iro_Tuple, "Tuple", floats, 1, 0);
op_Id = new_ir_op (iro_Id, "Id", floats, 0, 0);
op_Bad = new_ir_op (iro_Bad, "Bad", floats, 0, 0);
op_Proj = new_ir_op (iro_Proj, "Proj", floats, 0, sizeof (long));
op_Tuple = new_ir_op (iro_Tuple, "Tuple", floats, 1, 0);
op_Id = new_ir_op (iro_Id, "Id", floats, 0, 0);
op_Bad = new_ir_op (iro_Bad, "Bad", floats, 0, 0);
op_Confirm = new_ir_op (iro_Confirm, "Confirm", floats, 1, sizeof (confirm_attr));
op_Unknown = new_ir_op (iro_Unknown, "Unknown", floats, 0, 0);
op_Filter = new_ir_op (iro_Filter, "Filter", pinned, 0, sizeof(filter_attr));
op_Filter = new_ir_op (iro_Filter, "Filter", pinned, 1, sizeof(filter_attr));
op_Break = new_ir_op (iro_Break, "Break", pinned, 0, 0);
op_CallBegin = new_ir_op (iro_CallBegin, "CallBegin", pinned, 0, sizeof(callbegin_attr));
op_EndReg = new_ir_op (iro_EndReg, "EndReg", pinned, 0, sizeof(end_attr));
......
......@@ -38,7 +38,7 @@ typedef enum {
iro_Cmp, iro_Shl, iro_Shr, iro_Shrs, iro_Rot, iro_Conv, iro_Cast,
iro_Phi,
iro_Load, iro_Store, iro_Alloc, iro_Free, iro_Sync,
iro_Proj, iro_Tuple, iro_Id, iro_Bad,
iro_Proj, iro_Tuple, iro_Id, iro_Bad, iro_Confirm,
iro_Unknown, iro_Filter, iro_Break, iro_CallBegin, iro_EndReg, iro_EndExcept
} opcode;
......@@ -93,6 +93,7 @@ extern ir_op *op_Tuple; ir_op *get_op_Tuple (void);
extern ir_op *op_Proj; ir_op *get_op_Proj (void);
extern ir_op *op_Id; ir_op *get_op_Id (void);
extern ir_op *op_Bad; ir_op *get_op_Bad (void);
extern ir_op *op_Confirm; ir_op *get_op_Confirm (void);
extern ir_op *op_Unknown; ir_op *get_op_Unknown (void);
extern ir_op *op_Filter; ir_op *get_op_Filter (void);
......
......@@ -679,7 +679,7 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
/* Free: BB x M x ref --> M */
op1mode == mode_M && mode_is_reference(op2mode) &&
mymode == mode_M,
"Free node",0
"Free node", 0
);
break;
......@@ -695,6 +695,18 @@ int irn_vrfy_irg(ir_node *n, ir_graph *irg)
return vrfy_Proj_proj(n, irg);
break;
case iro_Confirm:
op1mode = get_irn_mode(in[1]);
op2mode = get_irn_mode(in[2]);
ASSERT_AND_RET(
/* Confirm: BB x T x T --> T */
op1mode == mymode &&
op2mode == mymode,
"Confirm node", 0
);
break;
default:
break;
}
......
Supports Markdown
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