that should remain due to strict fp rounding rules.
Removed unused Start attibutes.
Renamed attribute names to more understandable names.
[r7982]
ir_graph *irg = current_ir_graph;
assert(arg->op == op_Cond);
- arg->attr.c.kind = fragmentary;
- arg->attr.c.default_proj = max_proj;
+ arg->attr.cond.kind = fragmentary;
+ arg->attr.cond.default_proj = max_proj;
res = new_rd_Proj (db, irg, block, arg, mode_X, max_proj);
return res;
}
static ir_node *
-new_bd_Conv (dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode)
+new_bd_Conv (dbg_info *db, ir_node *block, ir_node *op, ir_mode *mode, int strict_flag)
{
ir_node *res;
ir_graph *irg = current_ir_graph;
res = new_ir_node(db, irg, block, op_Conv, mode, 1, &op);
+ res->attr.conv.strict = strict_flag;
res = optimize_node(res);
IRN_VRFY_IRG(res, irg);
return res;
ir_graph *irg = current_ir_graph;
res = new_ir_node (db, irg, block, op_Cond, mode_T, 1, &c);
- res->attr.c.kind = dense;
- res->attr.c.default_proj = 0;
- res->attr.c.pred = COND_JMP_PRED_NONE;
+ res->attr.cond.kind = dense;
+ res->attr.cond.default_proj = 0;
+ res->attr.cond.pred = COND_JMP_PRED_NONE;
res = optimize_node (res);
IRN_VRFY_IRG(res, irg);
return res;
in[0] = store;
in[1] = size;
res = new_ir_node(db, irg, block, op_Alloc, mode_T, 2, in);
- res->attr.a.exc.pin_state = op_pin_state_pinned;
- res->attr.a.where = where;
- res->attr.a.type = alloc_type;
+ res->attr.alloc.exc.pin_state = op_pin_state_pinned;
+ res->attr.alloc.where = where;
+ res->attr.alloc.type = alloc_type;
res = optimize_node(res);
IRN_VRFY_IRG(res, irg);
return res;
in[1] = ptr;
in[2] = size;
res = new_ir_node (db, irg, block, op_Free, mode_M, 3, in);
- res->attr.f.where = where;
- res->attr.f.type = free_type;
+ res->attr.free.where = where;
+ res->attr.free.type = free_type;
res = optimize_node(res);
IRN_VRFY_IRG(res, irg);
return res;
* FIXM: Sel's can select functions which should be of mode mode_P_code.
*/
res = new_ir_node(db, irg, block, op_Sel, mode_P_data, r_arity, r_in);
- res->attr.s.ent = ent;
+ res->attr.sel.ent = ent;
res = optimize_node(res);
IRN_VRFY_IRG(res, irg);
return res;
res = new_ir_node(db, irg, block, op_SymConst, mode, 0, NULL);
- res->attr.i.num = symkind;
- res->attr.i.sym = value;
- res->attr.i.tp = tp;
+ res->attr.symc.num = symkind;
+ res->attr.symc.sym = value;
+ res->attr.symc.tp = tp;
res = optimize_node(res);
IRN_VRFY_IRG(res, irg);
in[0] = store;
in[1] = objptr;
res = new_ir_node(db, irg, block, op_Sel, mode_T, 2, in);
- res->attr.io.type = type;
+ res->attr.instof.type = type;
res = optimize_node(res);
IRN_VRFY_IRG(res, irg);
return res;
ir_graph *rem = current_ir_graph;
current_ir_graph = irg;
- res = new_bd_Conv(db, block, op, mode);
+ res = new_bd_Conv(db, block, op, mode, 0);
current_ir_graph = rem;
return res;
case iro_Call:
return n->attr.call.exc.frag_arr;
case iro_Alloc:
- return n->attr.a.exc.frag_arr;
+ return n->attr.alloc.exc.frag_arr;
case iro_Load:
return n->attr.load.exc.frag_arr;
case iro_Store:
{
ir_node *res;
assert(arg->op == op_Cond);
- arg->attr.c.kind = fragmentary;
- arg->attr.c.default_proj = max_proj;
+ arg->attr.cond.kind = fragmentary;
+ arg->attr.cond.default_proj = max_proj;
res = new_Proj (arg, mode_X, max_proj);
return res;
}
ir_node *
-new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode)
-{
- return new_bd_Conv(db, current_ir_graph->current_block, op, mode);
+new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode) {
+ return new_bd_Conv(db, current_ir_graph->current_block, op, mode, 0);
}
ir_node *
-new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp)
-{
+new_d_strictConv (dbg_info *db, ir_node *op, ir_mode *mode) {
+ return new_bd_Conv(db, current_ir_graph->current_block, op, mode, 1);
+}
+
+ir_node *
+new_d_Cast (dbg_info *db, ir_node *op, ir_type *to_tp) {
return new_bd_Cast(db, current_ir_graph->current_block, op, to_tp);
}
ir_node *
-new_d_Tuple (dbg_info *db, int arity, ir_node **in)
-{
+new_d_Tuple (dbg_info *db, int arity, ir_node **in) {
return new_bd_Tuple(db, current_ir_graph->current_block, arity, in);
}
res = new_bd_Alloc (db, current_ir_graph->current_block,
store, size, alloc_type, where);
#if PRECISE_EXC_CONTEXT
- allocate_frag_arr(res, op_Alloc, &res->attr.a.exc.frag_arr); /* Could be optimized away. */
+ allocate_frag_arr(res, op_Alloc, &res->attr.alloc.exc.frag_arr); /* Could be optimized away. */
#endif
return res;
ir_node *new_Conv (ir_node *op, ir_mode *mode) {
return new_d_Conv(NULL, op, mode);
}
+ir_node *new_strictConv (ir_node *op, ir_mode *mode) {
+ return new_d_strictConv(NULL, op, mode);
+}
ir_node *new_Cast (ir_node *op, ir_type *to_tp) {
return new_d_Cast(NULL, op, to_tp);
}
/**
@todo
- Ideas for imrovement:
+ Ideas for improvement:
-# Handle construction of exceptions more comfortable:
Add new constructors that pass the exception region (or better the
Phi for the memories, the ex. region can be found from there) as parameter,
*/
ir_node *new_d_Conv (dbg_info *db, ir_node *op, ir_mode *mode);
+/** Constructor for a strict Conv node.
+ *
+ * Adds the node to the block in current_ir_block.
+ *
+ * @param *db A pointer for debug information.
+ * @param *op The operand.
+ * @param *mode The mode of this the operand muss be converted .
+ */
+ir_node *new_d_strictConv (dbg_info *db, ir_node *op, ir_mode *mode);
+
/** Constructor for a Cast node.
*
* High level type cast
*
* Adds the node to the block in current_ir_block.
*
- * @param *op The operand.
- * @param *mode The mode of this the operand muss be converted .
+ * @param *op The operand.
+ * @param *mode The mode of this the operand muss be converted.
*/
ir_node *new_Conv (ir_node *op, ir_mode *mode);
+/** Constructor for a strict Conv node.
+ *
+ * Adds the node to the block in current_ir_block.
+ *
+ * @param *op The operand.
+ * @param *mode The mode of this the operand muss be converted.
+ */
+ir_node *new_strictConv (ir_node *op, ir_mode *mode);
+
/** Constructor for a Cast node.
*
* Adds the node to the block in current_ir_block.
case iro_Block:
fprintf (F, "%s%s", is_Block_dead(n) ? "Dead " : "", get_irn_opname(n));
break;
+ case iro_Conv:
+ if (get_Conv_strict(n))
+ fprintf (F, "strict");
+ fprintf (F, "%s", get_irn_opname(n));
+ break;
default:
default_case:
get_irn_alloc_attr (ir_node *node)
{
assert (node->op == op_Alloc);
- return node->attr.a;
+ return node->attr.alloc;
}
free_attr
get_irn_free_attr (ir_node *node)
{
assert (node->op == op_Free);
- return node->attr.f;
+ return node->attr.free;
}
symconst_attr
get_irn_symconst_attr (ir_node *node)
{
assert (node->op == op_SymConst);
- return node->attr.i;
+ return node->attr.symc;
}
ir_type *
get_irn_sel_attr (ir_node *node)
{
assert (node->op == op_Sel);
- return node->attr.s;
+ return node->attr.sel;
}
int
cond_kind
get_Cond_kind (ir_node *node) {
assert (node->op == op_Cond);
- return node->attr.c.kind;
+ return node->attr.cond.kind;
}
void
set_Cond_kind (ir_node *node, cond_kind kind) {
assert (node->op == op_Cond);
- node->attr.c.kind = kind;
+ node->attr.cond.kind = kind;
}
long
get_Cond_defaultProj (ir_node *node) {
assert (node->op == op_Cond);
- return node->attr.c.default_proj;
+ return node->attr.cond.default_proj;
}
ir_node *
symconst_kind
get_SymConst_kind (const ir_node *node) {
assert (node->op == op_SymConst);
- return node->attr.i.num;
+ return node->attr.symc.num;
}
void
set_SymConst_kind (ir_node *node, symconst_kind num) {
assert (node->op == op_SymConst);
- node->attr.i.num = num;
+ node->attr.symc.num = num;
}
ir_type *
get_SymConst_type (ir_node *node) {
assert( (node->op == op_SymConst)
&& (SYMCONST_HAS_TYPE(get_SymConst_kind(node))));
- return node->attr.i.sym.type_p = skip_tid(node->attr.i.sym.type_p);
+ return node->attr.symc.sym.type_p = skip_tid(node->attr.symc.sym.type_p);
}
void
set_SymConst_type (ir_node *node, ir_type *tp) {
assert( (node->op == op_SymConst)
&& (SYMCONST_HAS_TYPE(get_SymConst_kind(node))));
- node->attr.i.sym.type_p = tp;
+ node->attr.symc.sym.type_p = tp;
}
ident *
get_SymConst_name (ir_node *node) {
assert ( (node->op == op_SymConst)
&& (get_SymConst_kind(node) == symconst_addr_name));
- return node->attr.i.sym.ident_p;
+ return node->attr.symc.sym.ident_p;
}
void
set_SymConst_name (ir_node *node, ident *name) {
assert ( (node->op == op_SymConst)
&& (get_SymConst_kind(node) == symconst_addr_name));
- node->attr.i.sym.ident_p = name;
+ node->attr.symc.sym.ident_p = name;
}
entity *get_SymConst_entity (ir_node *node) {
assert ( (node->op == op_SymConst)
&& (get_SymConst_kind (node) == symconst_addr_ent));
- return node->attr.i.sym.entity_p;
+ return node->attr.symc.sym.entity_p;
}
void set_SymConst_entity (ir_node *node, entity *ent) {
assert ( (node->op == op_SymConst)
&& (get_SymConst_kind(node) == symconst_addr_ent));
- node->attr.i.sym.entity_p = ent;
+ node->attr.symc.sym.entity_p = ent;
}
union symconst_symbol
get_SymConst_symbol (ir_node *node) {
assert (node->op == op_SymConst);
- return node->attr.i.sym;
+ return node->attr.symc.sym;
}
void
set_SymConst_symbol (ir_node *node, union symconst_symbol sym) {
assert (node->op == op_SymConst);
- //memcpy (&(node->attr.i.sym), sym, sizeof(type_or_id));
- node->attr.i.sym = sym;
+ node->attr.symc.sym = sym;
}
ir_type *
get_SymConst_value_type (ir_node *node) {
assert (node->op == op_SymConst);
- if (node->attr.i.tp) node->attr.i.tp = skip_tid(node->attr.i.tp);
- return node->attr.i.tp;
+ if (node->attr.symc.tp) node->attr.symc.tp = skip_tid(node->attr.symc.tp);
+ return node->attr.symc.tp;
}
void
set_SymConst_value_type (ir_node *node, ir_type *tp) {
assert (node->op == op_SymConst);
- node->attr.i.tp = tp;
+ node->attr.symc.tp = tp;
}
ir_node *
entity *
get_Sel_entity (ir_node *node) {
assert (node->op == op_Sel);
- return node->attr.s.ent;
+ return node->attr.sel.ent;
}
void
set_Sel_entity (ir_node *node, entity *ent) {
assert (node->op == op_Sel);
- node->attr.s.ent = ent;
+ node->attr.sel.ent = ent;
}
ir_node *
get_Mod_mem (ir_node *node) {
- assert (node->op == op_Mod);
+ assert(node->op == op_Mod);
return get_irn_n(node, 0);
}
void
set_Mod_mem (ir_node *node, ir_node *mem) {
- assert (node->op == op_Mod);
+ assert(node->op == op_Mod);
set_irn_n(node, 0, mem);
}
UNOP(Conv)
UNOP(Cast)
+int get_Conv_strict(ir_node *node) {
+ assert(node->op == op_Conv);
+ return node->attr.conv.strict;
+}
+
+void set_Conv_strict(ir_node *node, int strict_flag) {
+ assert(node->op == op_Conv);
+ node->attr.conv.strict = (char)strict_flag;
+}
+
ir_type *
get_Cast_type (ir_node *node) {
- assert (node->op == op_Cast);
+ assert(node->op == op_Cast);
return node->attr.cast.totype;
}
void
set_Cast_type (ir_node *node, ir_type *to_tp) {
- assert (node->op == op_Cast);
+ assert(node->op == op_Cast);
node->attr.cast.totype = to_tp;
}
ir_type *
get_Alloc_type (ir_node *node) {
assert (node->op == op_Alloc);
- return node->attr.a.type = skip_tid(node->attr.a.type);
+ return node->attr.alloc.type = skip_tid(node->attr.alloc.type);
}
void
set_Alloc_type (ir_node *node, ir_type *tp) {
assert (node->op == op_Alloc);
- node->attr.a.type = tp;
+ node->attr.alloc.type = tp;
}
where_alloc
get_Alloc_where (ir_node *node) {
assert (node->op == op_Alloc);
- return node->attr.a.where;
+ return node->attr.alloc.where;
}
void
set_Alloc_where (ir_node *node, where_alloc where) {
assert (node->op == op_Alloc);
- node->attr.a.where = where;
+ node->attr.alloc.where = where;
}
ir_type *
get_Free_type (ir_node *node) {
assert (node->op == op_Free);
- return node->attr.f.type = skip_tid(node->attr.f.type);
+ return node->attr.free.type = skip_tid(node->attr.free.type);
}
void
set_Free_type (ir_node *node, ir_type *tp) {
assert (node->op == op_Free);
- node->attr.f.type = tp;
+ node->attr.free.type = tp;
}
where_alloc
get_Free_where (ir_node *node) {
assert (node->op == op_Free);
- return node->attr.f.where;
+ return node->attr.free.where;
}
void
set_Free_where (ir_node *node, where_alloc where) {
assert (node->op == op_Free);
- node->attr.f.where = where;
+ node->attr.free.where = where;
}
ir_node **get_Sync_preds_arr (ir_node *node) {
ir_type *
get_InstOf_type (ir_node *node) {
assert (node->op = op_InstOf);
- return node->attr.io.type;
+ return node->attr.instof.type;
}
void
set_InstOf_type (ir_node *node, ir_type *type) {
assert (node->op = op_InstOf);
- node->attr.io.type = type;
+ node->attr.instof.type = type;
}
ir_node *
* File name: ir/ir/irnode.h
* Purpose: Representation of an intermediate operation.
* Author: Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier
+ * Modified by: Goetz Lindenmaier, Michael Beck
* Created:
* CVS-ID: $Id$
* Copyright: (c) 1998-2003 Universität Karlsruhe
ir_node *get_Conv_op (ir_node *node);
void set_Conv_op (ir_node *node, ir_node *op);
+int get_Conv_strict (ir_node *node);
+void set_Conv_strict (ir_node *node, int flag);
/* Does Cast need a mem operator?
* Cast should only depend on the type, not on the state of an
} block_attr;
-/** Start attributes */
-typedef struct {
- char dummy;
- /* ir_graph *irg; @@@ now in block */
-} start_attr;
-
-/** Cond attributes */
+/** Cond attributes. */
typedef struct {
cond_kind kind; /**< flavor of Cond */
long default_proj; /**< only for non-binary Conds: biggest Proj number, i.e. the one used for default. */
cond_jmp_predicate pred; /**< only for binary Conds: The jump predication. */
} cond_attr;
-/** Const attributes */
+/** Const attributes. */
typedef struct {
tarval *tv; /**< the target value */
ir_type *tp; /**< the source type, for analyses. default: type_unknown. */
} const_attr;
+/** SymConst attributes. */
typedef struct {
symconst_symbol sym; // old tori
symconst_kind num;
ir_type *tp; /**< the source type, for analyses. default: type_unknown. */
} symconst_attr;
-/** Sel attributes */
+/** Sel attributes. */
typedef struct {
entity *ent; /**< entity to select */
} sel_attr;
-/** Exception attributes */
+/** Exception attributes. */
typedef struct {
op_pin_state pin_state; /**< the pin state for operations that might generate a exception:
If it's know that no exception will be generated, could be set to
#endif
} except_attr;
-/** Call attributes */
+/** Call attributes. */
typedef struct {
except_attr exc; /**< the exception attribute. MUST be the first one. */
ir_type *cld_tp; /**< type of called procedure */
entity ** callee_arr; /**< result of callee analysis */
} call_attr;
-/** Alloc attributes */
+/** Alloc attributes. */
typedef struct {
except_attr exc; /**< the exception attribute. MUST be the first one. */
ir_type *type; /**< Type of the allocated object. */
where_alloc where; /**< stack, heap or other managed part of memory */
} alloc_attr;
-/** Free attributes */
+/** Free attributes. */
typedef struct {
ir_type *type; /**< Type of the allocated object. */
where_alloc where; /**< stack, heap or other managed part of memory */
} free_attr;
-/** InstOf attributes */
+/** InstOf attributes. */
typedef struct {
except_attr exc; /**< the exception attribute. MUST be the first one. */
ir_type *type; /**< the type of which the object pointer must be */
} io_attr;
-/** Filter attributes */
+/** Filter attributes. */
typedef struct {
long proj; /**< contains the result position to project (Proj) */
ir_node ** in_cg; /**< array with interprocedural predecessors (Phi) */
@todo Ev. replace by bitfield! */
} filter_attr;
-/** EndReg/EndExcept attributes */
+/** EndReg/EndExcept attributes. */
typedef struct {
char dummy;
} end_attr;
-/** CallBegin attributes */
+/** CallBegin attributes. */
typedef struct {
ir_node * call; /**< Associated Call-operation. */
} callbegin_attr;
-/** Cast attributes */
+/** Cast attributes. */
typedef struct {
ir_type *totype; /**< Type of the casted node. */
} cast_attr;
-/** Load attributes */
+/** Load attributes. */
typedef struct {
except_attr exc; /**< The exception attribute. MUST be the first one. */
ir_mode *load_mode; /**< The mode of this Load operation. */
ent_volatility volatility; /**< The volatility of a Load/Store operation. */
} load_attr;
-/** Store attributes */
+/** Store attributes. */
typedef struct {
except_attr exc; /**< the exception attribute. MUST be the first one. */
ent_volatility volatility; /**< the volatility of a Store operation */
typedef pn_Cmp confirm_attr; /**< Attribute to hold compare operation */
-/** CopyB attribute */
+/** CopyB attribute. */
typedef struct {
except_attr exc; /**< The exception attribute. MUST be the first one. */
ir_type *data_type; /**< Type of the copied entity. */
} copyb_attr;
-/** Bound attribute */
+/** Bound attribute. */
typedef struct {
except_attr exc; /**< The exception attribute. MUST be the first one. */
} bound_attr;
+/** Conv attribute. */
+typedef struct {
+ char strict; /**< If set, this is a strict Conv that cannot be removed. */
+} conv_attr;
+
/**
* Edge info to put into an irn.
*/
/** Some IR-nodes just have one attribute, these are stored here,
some have more. Their name is 'irnodename_attr' */
typedef union {
- start_attr start; /**< For Start */
- block_attr block; /**< For Block: Fields needed to construct it */
- cond_attr c; /**< For Cond. */
- const_attr con; /**< For Const: contains the value of the constant and a type */
- symconst_attr i; /**< For SymConst. */
- sel_attr s; /**< For Sel. */
- call_attr call; /**< For Call: pointer to the type of the method to call */
+ block_attr block; /**< For Block: Fields needed to construct it */
+ cond_attr cond; /**< For Cond. */
+ const_attr con; /**< For Const: contains the value of the constant and a type */
+ symconst_attr symc; /**< For SymConst. */
+ sel_attr sel; /**< For Sel. */
+ call_attr call; /**< For Call: pointer to the type of the method to call */
callbegin_attr callbegin; /**< For CallBegin */
- alloc_attr a; /**< For Alloc. */
- free_attr f; /**< For Free. */
- io_attr io; /**< For InstOf */
- cast_attr cast; /**< For Cast. */
- load_attr load; /**< For Load. */
+ alloc_attr alloc; /**< For Alloc. */
+ free_attr free; /**< For Free. */
+ io_attr instof; /**< For InstOf */
+ cast_attr cast; /**< For Cast. */
+ load_attr load; /**< For Load. */
store_attr store; /**< For Store. */
int phi0_pos; /**< For Phi. Used to remember the value defined by
this Phi node. Needed when the Phi is completed
except_attr except; /**< For Phi node construction in case of exceptions */
copyb_attr copyb; /**< For CopyB operation */
bound_attr bound; /**< For Bound operation */
+ conv_attr conv; /**< For Conv operation */
} attr;
static INLINE cond_jmp_predicate _get_Cond_jmp_pred(ir_node *node) {
assert (_get_irn_op(node) == op_Cond);
- return node->attr.c.pred;
+ return node->attr.cond.pred;
}
static INLINE void _set_Cond_jmp_pred(ir_node *node, cond_jmp_predicate pred) {
assert (_get_irn_op(node) == op_Cond);
- node->attr.c.pred = pred;
+ node->attr.cond.pred = pred;
}
static INLINE int _get_Psi_n_conds(ir_node *node) {
op_Block = new_ir_op(iro_Block, "Block", op_pin_state_pinned, L, oparity_variable, -1, sizeof(block_attr), NULL);
- op_Start = new_ir_op(iro_Start, "Start", op_pin_state_pinned, X, oparity_zero, -1, sizeof(start_attr), NULL);
+ op_Start = new_ir_op(iro_Start, "Start", op_pin_state_pinned, X, oparity_zero, -1, 0, NULL);
op_End = new_ir_op(iro_End, "End", op_pin_state_pinned, X, oparity_dynamic, -1, 0, NULL);
op_Jmp = new_ir_op(iro_Jmp, "Jmp", op_pin_state_pinned, X, oparity_zero, -1, 0, NULL);
op_IJmp = new_ir_op(iro_IJmp, "IJmp", op_pin_state_pinned, X|K, oparity_unary, -1, 0, NULL);
op_Shr = new_ir_op(iro_Shr, "Shr", op_pin_state_floats, N, oparity_binary, 0, 0, NULL);
op_Shrs = new_ir_op(iro_Shrs, "Shrs", op_pin_state_floats, N, oparity_binary, 0, 0, NULL);
op_Rot = new_ir_op(iro_Rot, "Rot", op_pin_state_floats, N, oparity_binary, 0, 0, NULL);
- op_Conv = new_ir_op(iro_Conv, "Conv", op_pin_state_floats, N, oparity_unary, 0, 0, NULL);
+ op_Conv = new_ir_op(iro_Conv, "Conv", op_pin_state_floats, N, oparity_unary, 0, sizeof(conv_attr), NULL);
op_Cast = new_ir_op(iro_Cast, "Cast", op_pin_state_floats, N|H, oparity_unary, 0, sizeof(cast_attr), NULL);
op_Carry = new_ir_op(iro_Carry, "Carry", op_pin_state_floats, C, oparity_binary, 0, 0, NULL);
op_Borrow = new_ir_op(iro_Borrow, "Borrow", op_pin_state_floats, N, oparity_binary, 0, 0, NULL);