}
-ir_node *
-new_rd_FuncCall (dbg_info* db, ir_graph *irg, ir_node *block,
- ir_node *callee, int arity, ir_node **in, type *tp)
+INLINE ir_node *
+new_rd_NoMem (ir_graph *irg)
{
- ir_node **r_in;
- ir_node *res;
- int r_arity;
-
- r_arity = arity+1;
- NEW_ARR_A(ir_node *, r_in, r_arity);
- r_in[0] = callee;
- memcpy(&r_in[1], in, sizeof (ir_node *) * arity);
-
- res = new_ir_node(db, irg, block, op_FuncCall, mode_T, r_arity, r_in);
-
- assert(is_method_type(tp));
- set_FuncCall_type(res, tp);
- res->attr.call.callee_arr = NULL;
- res = optimize_node(res);
- IRN_VRFY_IRG(res, irg);
- return res;
+ return irg->no_mem;
}
ir_mode *mode, long proj) {
return new_rd_Filter(NULL, irg, block, arg, mode, proj);
}
-INLINE ir_node *new_r_FuncCall (ir_graph *irg, ir_node *block,
- ir_node *callee, int arity, ir_node **in,
- type *tp) {
- return new_rd_FuncCall(NULL, irg, block, callee, arity, in, tp);
+INLINE ir_node *new_r_NoMem (ir_graph *irg) {
+ return new_rd_NoMem(irg);
}
}
ir_node *
-new_d_FuncCall (dbg_info* db, ir_node *callee, int arity, ir_node **in,
- type *tp)
+(new_d_NoMem)(void)
{
- ir_node *res;
- res = new_rd_FuncCall (db, current_ir_graph, current_ir_graph->current_block,
- callee, arity, in, tp);
-
- return res;
+ return __new_d_NoMem();
}
/* ********************************************************************* */
ir_node *new_Filter (ir_node *arg, ir_mode *mode, long proj) {
return new_d_Filter(NULL, arg, mode, proj);
}
-ir_node *new_FuncCall (ir_node *callee, int arity, ir_node **in, type *tp) {
- return new_d_FuncCall(NULL, callee, arity, in, tp);
+ir_node *new_NoMem (void) {
+ return new_d_NoMem();
}
* ir_node *new_Free (ir_node *store, ir_node *ptr, ir_node *size,
* type *free_type);
* ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj);
- * ir_node *new_FuncCall (ir_node *store, ir_node *callee, int arity,
- * ir_node **in, type_method *type);
+ * ir_node *new_NoMem (void);
*
* void add_immBlock_pred (ir_node *block, ir_node *jmp);
* void mature_immBlock (ir_node *block);
* Attributes:
* attr.call Contains the type information for the procedure.
*
- * ir_node *new_FuncCall (ir_node *callee, int arity, ir_node **in, type_method *type)
- * -----------------------------------------------------------------------------------
- *
- * Creates a procedure call to a function WITHOUT memory side effects.
- * nodes of this kind are floating in contrast to Call nodes.
- * Further, a procedure call with FuncCall cannot raise an exception!
- *
- * Parameters
- * *callee A pointer to the called procedure.
- * arity The number of procedure parameters.
- * **in An array with the pointers to the parameters.
- * The constructor copies this array.
- * *type Type information of the procedure called.
- *
- * Inputs:
- * The callee and the parameters.
- * Output:
- * A tuple containing the procedure results.
- * Attributes:
- * attr.call Contains the type information for the procedure.
*
* ir_node *new_Add (ir_node *op1, ir_node *op2, ir_mode *mode)
* ------------------------------------------------------------
* Returns the unique Bad node current_ir_graph->bad.
* This node is used to express results of dead code elimination.
*
+ * ir_node *new_NoMem (void)
+ * -----------------------------------------------------------------------------------
+ *
+ * Returns the unique NoMem node current_ir_graph->no_mem.
+ * This node is used as input for operations that need a Memory, but do not
+ * change it like Div by const != 0, analyzed calls etc.
+ *
* ir_node *new_Proj (ir_node *arg, ir_mode *mode, long proj)
* ----------------------------------------------------------
*
ir_node *new_rd_Call (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *store,
ir_node *callee, int arity, ir_node *in[], type *tp);
-/** Constructor for a FuncCall node.
- *
- * FuncCall is a function Call that has no side effects. Therefore there
- * is not memory operand or result.
- *
- * @param *db A pointer for debug information.
- * @param *irg The ir graph the node belong to.
- * @param *block The block the node belong to.
- * @param *callee A pointer to the called procedure.
- * @param arity The number of procedure parameters.
- * @param *in[] An array with the pointers to the parameters. The constructor
- * copies this array.
- * @param *tp Type information of the procedure called.
- */
-ir_node *new_rd_FuncCall (dbg_info *db, ir_graph *irg, ir_node *block,
- ir_node *callee, int arity, ir_node *in[],
- type *tp);
-
/** Constructor for a Add node.
*
* @param *db A pointer for debug information.
ir_node *new_rd_Filter (dbg_info *db, ir_graph *irg, ir_node *block, ir_node *arg,
ir_mode *mode, long proj);
+/** Constructor for a NoMem node.
+ *
+ * Returns the unique NoMem node of the graph. The same as
+ * get_irg_no_mem().
+ *
+ * @param *irg The ir graph the node belongs to.
+ */
+ir_node *new_rd_NoMem (ir_graph *irg);
/*-------------------------------------------------------------------------*/
/* The raw interface without debug support */
ir_node *new_r_Filter (ir_graph *irg, ir_node *block, ir_node *arg,
ir_mode *mode, long proj);
-/** Constructor for a FuncCall node.
+/** Constructor for a NoMem node.
*
- * FuncCall is a function Call that has no side effects. Therefore there
- * is not memory operand or result.
+ * Returns the unique NoMem node of the graph. The same as
+ * get_irg_no_mem().
*
- * @param *irg The ir graph the node belong to.
- * @param *block The block the node belong to.
- * @param *callee A pointer to the called procedure.
- * @param arity The number of procedure parameters.
- * @param *in[] An array with the pointers to the parameters.
- * The constructor copies this array.
- * @param *type Type information of the procedure called.
+ * @param *irg The ir graph the node belongs to.
*/
-ir_node *new_r_FuncCall (ir_graph *irg, ir_node *block,
- ir_node *callee, int arity, ir_node *in[],
- type *tp);
+ir_node *new_r_NoMem (ir_graph *irg);
/*-----------------------------------------------------------------------*/
/* The block oriented interface */
ir_node *new_d_Filter (dbg_info *db, ir_node *arg, ir_mode *mode, long proj);
-/** Constructor for a FuncCall node.
+/** Constructor for a NoMem node.
*
- * FuncCall is a function Call that has no side effects. Therefore there
- * is not memory operand or result. Adds the node to the block in current_ir_block.
- *
- * @param *db A pointer for debug information.
- * @param *callee A pointer to the called procedure.
- * @param arity The number of procedure parameters.
- * @param **in An array with the pointers to the parameters.
- * The constructor copies this array.
- * @param *tp Type information of the procedure called.
+ * Returns the unique NoMem node of the graph. The same as
+ * get_irg_no_mem().
*/
-ir_node *new_d_FuncCall (dbg_info* db, ir_node *callee, int arity, ir_node *in[],
- type *tp);
+ir_node *new_d_NoMem (void);
/*-----------------------------------------------------------------------*/
/* The block oriented interface without debug support */
* Returns the unique Bad node of the graph. The same as
* get_irg_bad().
*/
-
ir_node *new_Bad (void);
/** Constructor for a Confirm node.
*/
ir_node *new_Unknown(ir_mode *m);
-/** Constructor for a FuncCall node.
+/** Constructor for a NoMem node.
*
- * FuncCall is a function Call that has no side effects. Therefore there
- * is not memory operand or result.Adds the node to the block in current_ir_block.
- *
- * @param *callee A pointer to the called procedure.
- * @param arity The number of procedure parameters.
- * @param **in An array with the pointers to the parameters.
- * The constructor copies this array.
- * @param *tp Type information of the procedure called.
+ * Returns the unique NoMem node of the graph. The same as
+ * get_irg_no_mem().
*/
-ir_node *new_FuncCall (ir_node *callee, int arity, ir_node *in[],
- type *tp);
+ir_node *new_NoMem (void);
/*---------------------------------------------------------------------*/
/* The comfortable interface. */
return current_ir_graph->bad;
}
+static INLINE ir_node *
+__new_d_NoMem(void) {
+ return current_ir_graph->no_mem;
+}
+
+
#define new_d_Bad() __new_d_Bad()
+#define new_d_NoMem() __new_d_NoMem()
#endif /* _IRCONS_T_H_ */
if (is_Block(node)
|| node_floats(node)
|| get_irn_op(node) == op_Bad
- || get_irn_op(node) == op_Unknown) {
+ || get_irn_op(node) == op_Unknown
+ || get_irn_op(node) == op_NoMem) {
ir_node ** arr = (ir_node **) ird_get_irg_link(get_irn_irg(node));
if (!arr) arr = NEW_ARR_F(ir_node *, 0);
ARR_APP1(ir_node *, arr, node);
/** Construct lists to walk ir block-wise.
*
* Collects all blocks, nodes not op_pin_state_pinned,
- * Bad and Unknown into a flexible array in link field of
+ * Bad, NoMem and Unknown into a flexible array in link field of
* irg they belong to. Sets the irg link field to NULL in all
* graphs not visited.
* Free the list with DEL_ARR_F. */
case iro_Free:
case iro_Sync:
case iro_Jmp:
+ case iro_NoMem:
break;
default: {
ir_mode *mode = get_irn_mode(n);
return bad;
}
-
+/**
+ * checks wheater a node is "constant-like", ie can be treated "block-less"
+ */
static INLINE
bool is_constlike_node(ir_node *n) {
ir_op *op = get_irn_op(n);
- return (op == op_Const || op == op_Bad || op == op_SymConst || op == op_Unknown);
+ return (op == op_Const || op == op_Bad || op == op_NoMem || op == op_SymConst || op == op_Unknown);
}
/* Basic type and entity nodes and edges. */
/*******************************************************************/
-/* dumps the edges between nodes and their type or entity attributes. */
+/** dumps the edges between nodes and their type or entity attributes. */
static void dump_node2type_edges(ir_node *n, void *env)
{
FILE *F = env;
* - Remove Store that overwrites a just stored value (WAW).
* - Remove Store if it stores a value just loaded (WAR with the same value).
* - Remove Load that loads a value just saved (RAW with the same value).
+ * - remove Load that loads a value already loaded (RAR)
+ * - replace Load of constant values with constants (RC)
*/
void set_opt_redundant_LoadStore(int value);
*/
static void
copy_graph (int copy_node_nr) {
- ir_node *oe, *ne, *ob, *nb; /* old end, new end, old bad, new bad */
+ ir_node *oe, *ne, *ob, *nb, *om, *nm; /* old end, new end, old bad, new bad, old NoMem, new NoMem */
ir_node *ka; /* keep alive */
int i, irn_arity;
copy_attrs(oe, ne);
set_new_node(oe, ne);
+ /* copy the Bad node */
ob = get_irg_bad(current_ir_graph);
nb = new_ir_node(get_irn_dbg_info(ob),
current_ir_graph,
NULL);
set_new_node(ob, nb);
+ /* copy the NoMem node */
+ om = get_irg_no_mem(current_ir_graph);
+ nm = new_ir_node(get_irn_dbg_info(om),
+ current_ir_graph,
+ NULL,
+ op_NoMem,
+ mode_M,
+ 0,
+ NULL);
+ set_new_node(om, nm);
+
/* copy the live nodes */
irg_walk(get_nodes_block(oe), copy_node, copy_preds, (void *)copy_node_nr);
/* copy_preds for the end node ... */
}
}
- /* start block somtimes only reached after keep alives */
+ /* start block sometimes only reached after keep alives */
set_nodes_block(nb, get_new_node(get_nodes_block(ob)));
+ set_nodes_block(nm, get_new_node(get_nodes_block(om)));
}
/**
set_irn_link(get_irg_globals (current_ir_graph), NULL);
set_irn_link(get_irg_args (current_ir_graph), NULL);
set_irn_link(get_irg_initial_mem(current_ir_graph), NULL);
+ set_irn_link(get_irg_no_mem (current_ir_graph), NULL);
/* we use the block walk flag for removing Bads from Blocks ins. */
inc_irg_block_visited(current_ir_graph);
copy_preds(get_irg_bad(current_ir_graph), NULL);
}
set_irg_bad(current_ir_graph, get_new_node(get_irg_bad(current_ir_graph)));
+
+ if (get_irn_link(get_irg_no_mem(current_ir_graph)) == NULL) {
+ copy_node(get_irg_no_mem(current_ir_graph), (void *)copy_node_nr);
+ copy_preds(get_irg_no_mem(current_ir_graph), NULL);
+ }
+ set_irg_no_mem(current_ir_graph, get_new_node(get_irg_no_mem(current_ir_graph)));
}
/**
res->start_block = new_immBlock();
res->start = new_Start();
res->bad = new_ir_node(NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
+ res->no_mem = new_ir_node(NULL, res, res->start_block, op_NoMem, mode_M, 0, NULL);
/* Proj results of start node */
projX = new_Proj (res->start, mode_X, pn_Start_X_initial_exec);
- res->frame = new_Proj (res->start, mode_P_mach, pn_Start_P_frame_base); res->globals = new_Proj (res->start, mode_P_mach, pn_Start_P_globals);
+ res->frame = new_Proj (res->start, mode_P_mach, pn_Start_P_frame_base);
+ res->globals = new_Proj (res->start, mode_P_mach, pn_Start_P_globals);
res->initial_mem = new_Proj (res->start, mode_M, pn_Start_M);
res->args = new_Proj (res->start, mode_T, pn_Start_T_args);
#ifdef DEBUG_libfirm
res->end_reg = res->end;
res->end_except = res->end;
mature_immBlock(get_cur_block()); /* mature the end block */
- res->bad = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
+ res->bad = new_ir_node (NULL, res, res->start_block, op_Bad, mode_T, 0, NULL);
+ res->no_mem = new_ir_node (NULL, res, res->start_block, op_NoMem, mode_M, 0, NULL);
res->start = new_Start ();
res->initial_mem = new_Proj (res->start, mode_M, pn_Start_M);
set_Block_block_visited(res->start_block, -1);
set_irn_visited(res->start_block, -1);
set_irn_visited(res->bad, -1);
+ set_irn_visited(res->no_mem, -1);
res->phase_state = phase_high;
return res;
__set_irg_bad(irg, node);
}
-/* GL removed: we need unknown with mode for analyses.
ir_node *
-get_irg_unknown (ir_graph *irg)
-{
- return irg->unknown;
+(get_irg_no_mem)(const ir_graph *irg) {
+ return __get_irg_no_mem(irg);
}
void
-set_irg_unknown (ir_graph *irg, ir_node *node)
-{
- irg->unknown = node;
+(set_irg_no_mem)(ir_graph *irg, ir_node *node) {
+ __set_irg_no_mem(irg, node);
}
-*/
ir_node *
(get_irg_current_block)(const ir_graph *irg) {
ir_node *get_irg_bad (const ir_graph *irg);
void set_irg_bad (ir_graph *irg, ir_node *node);
+/** Returns the NoMem node. Use new_NoMem() instead!! */
+ir_node *get_irg_no_mem (const ir_graph *irg);
+void set_irg_no_mem (ir_graph *irg, ir_node *node);
+
/** Returns the number of value numbers of a graph. */
int get_irg_n_locs (ir_graph *irg);
struct ir_node *args; /**< methods arguments */
struct ir_node *bad; /**< bad node of this ir_graph, the one and
only in this graph */
+ struct ir_node *no_mem; /**< NoMem node of this ir_graph, the one and
+ only in this graph */
/* GL removed: we need unknown with mode for analyses. */
/* struct ir_node *unknown;*/ /**< unknown node of this ir_graph */
struct obstack *obst; /**< obstack where all of the ir_nodes live */
irg->bad = node;
}
+static INLINE ir_node *
+__get_irg_no_mem(const ir_graph *irg) {
+ return irg->no_mem;
+}
+
+static INLINE void
+__set_irg_no_mem(ir_graph *irg, ir_node *node) {
+ irg->no_mem = node;
+}
static INLINE ir_node *
__get_irg_current_block(const ir_graph *irg) {
return irg->current_block;
#define set_irg_args(irg, node) __set_irg_args(irg, node)
#define get_irg_bad(irg) __get_irg_bad(irg)
#define set_irg_bad(irg, node) __set_irg_bad(irg, node)
+#define get_irg_no_mem(irg) __get_irg_no_mem(irg)
+#define set_irg_no_mem(irg, node) __set_irg_no_mem(irg, node)
#define get_irg_current_block(irg) __get_irg_current_block(irg)
#define set_irg_current_block(irg, node) __set_irg_current_block(irg, node)
#define get_irg_entity(irg) __get_irg_entity(irg)
if (get_irn_op(node) == op_Tuple)
return;
- assert(node && get_op_pinned(get_irn_op(node)) == op_pin_state_exc_pinned);
+ assert(node && get_op_pinned(get_irn_op(node)) >= op_pin_state_exc_pinned);
assert(state == op_pin_state_pinned || state == op_pin_state_floats);
node->attr.except.pin_state = state;
return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp);
}
-type *
-get_irn_funccall_attr (ir_node *node)
-{
- assert (node->op == op_FuncCall);
- return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp);
-}
-
sel_attr
get_irn_sel_attr (ir_node *node)
{
get_irn_except_attr (ir_node *node)
{
assert (node->op == op_Div || node->op == op_Quot ||
- node->op == op_DivMod || node->op == op_Mod);
+ node->op == op_DivMod || node->op == op_Mod || node->op == op_Call || node->op == op_Alloc);
return node->attr.except;
}
node->attr.callbegin.call = call;
}
-ir_node *
-get_FuncCall_ptr (ir_node *node) {
- assert (node->op == op_FuncCall);
- return get_irn_n(node, 0);
-}
-
-void
-set_FuncCall_ptr (ir_node *node, ir_node *ptr) {
- assert (node->op == op_FuncCall);
- set_irn_n(node, 0, ptr);
-}
-
-ir_node **
-get_FuncCall_param_arr (ir_node *node) {
- assert (node->op == op_FuncCall);
- return (ir_node **)&get_irn_in(node)[FUNCCALL_PARAM_OFFSET];
-}
-
-int
-get_FuncCall_n_params (ir_node *node) {
- assert (node->op == op_FuncCall);
- return (get_irn_arity(node) - FUNCCALL_PARAM_OFFSET);
-}
-
-int
-get_FuncCall_arity (ir_node *node) {
- assert (node->op == op_FuncCall);
- return get_FuncCall_n_params(node);
-}
-
-/* void
-set_FuncCall_arity (ir_node *node, ir_node *arity) {
- assert (node->op == op_FuncCall);
-}
-*/
-
-ir_node *
-get_FuncCall_param (ir_node *node, int pos) {
- assert (node->op == op_FuncCall);
- return get_irn_n(node, pos + FUNCCALL_PARAM_OFFSET);
-}
-
-void
-set_FuncCall_param (ir_node *node, int pos, ir_node *param) {
- assert (node->op == op_FuncCall);
- set_irn_n(node, pos + FUNCCALL_PARAM_OFFSET, param);
-}
-
-type *
-get_FuncCall_type (ir_node *node) {
- assert (node->op == op_FuncCall);
- return node->attr.call.cld_tp = skip_tid(node->attr.call.cld_tp);
-}
-
-void
-set_FuncCall_type (ir_node *node, type *tp) {
- assert (node->op == op_FuncCall);
- assert (is_method_type(tp));
- node->attr.call.cld_tp = tp;
-}
-
-int FuncCall_has_callees(ir_node *node) {
- return ((get_irg_callee_info_state(get_irn_irg(node)) != irg_callee_info_none) &&
- (node->attr.call.callee_arr != NULL));
-}
-
-int get_FuncCall_n_callees(ir_node * node) {
- assert(node->op == op_FuncCall && node->attr.call.callee_arr);
- return ARR_LEN(node->attr.call.callee_arr);
-}
-
-entity * get_FuncCall_callee(ir_node * node, int pos) {
- assert(node->op == op_FuncCall && node->attr.call.callee_arr);
- return node->attr.call.callee_arr[pos];
-}
-
-void set_FuncCall_callee_arr(ir_node * node, int n, entity ** arr) {
- assert(node->op == op_FuncCall);
- if (node->attr.call.callee_arr == NULL || get_Call_n_callees(node) != n) {
- node->attr.call.callee_arr = NEW_ARR_D(entity *, current_ir_graph->obst, n);
- }
- memcpy(node->attr.call.callee_arr, arr, n * sizeof(entity *));
-}
-
-void remove_FuncCall_callee_arr(ir_node * node) {
- assert(node->op == op_FuncCall);
- node->attr.call.callee_arr = NULL;
-}
-
#define BINOP(OP) \
ir_node * get_##OP##_left(ir_node *node) { \
ir_node *get_CallBegin_call (ir_node *node);
void set_CallBegin_call (ir_node *node, ir_node *call);
-ir_node *get_FuncCall_ptr (ir_node *node);
-void set_FuncCall_ptr (ir_node *node, ir_node *ptr);
-ir_node **get_FuncCall_param_arr (ir_node *node);
-/** Gets the number of parameters of a func call. */
-int get_FuncCall_n_params (ir_node *node);
-/** Gets the func call parameter at position pos. */
-ir_node *get_FuncCall_param (ir_node *node, int pos);
-/** Sets the func call parameter at position pos. */
-void set_FuncCall_param (ir_node *node, int pos, ir_node *param);
-/** Gets the type of a func call. */
-type *get_FuncCall_type (ir_node *node);
-/** Sets the type of a func call. */
-void set_FuncCall_type (ir_node *node, type *tp);
-/** Gets the arity of a func call. Identical to get_FuncCall_n_params(). */
-int get_FuncCall_arity (ir_node *node);
-
-/** Set, get and remove the callee information for a Call node.
- *
- * The callee information lists all method entities that can be called
- * from this node. If the address expression can not be analyzed fully,
- * e.g., as there are external methods that could be called, the array
- * contains a single NULL entry.
- *
- * The array is only accessible if callee information is valid. See flag
- * in graph.
- *
- * The memory allocated for the array is managed automatically, i.e., it must
- * not be freed if the Call node is removed from the graph.
- *
- * @param node A FuncCall node.
- */
-int FuncCall_has_callees (ir_node *node);
-int get_FuncCall_n_callees (ir_node * node);
-entity *get_FuncCall_callee (ir_node * node, int pos);
-/* assumes current_ir_graph set properly! */
-void set_FuncCall_callee_arr (ir_node * node, int n, entity ** arr);
-void remove_FuncCall_callee_arr(ir_node * node);
-
/* For unary and binary arithmetic operations the access to the
operands can be factored out. Left is the first, right the
second arithmetic value as listed in tech report 1999-44.
static INLINE op_pin_state
__get_irn_pinned(const ir_node *node) {
op_pin_state state = __get_op_pinned(__get_irn_op(node));
- if (state == op_pin_state_exc_pinned)
+ if (state >= op_pin_state_exc_pinned)
return get_opt_fragile_ops() ? node->attr.except.pin_state : op_pin_state_pinned;
return state;
}
ir_op *op_EndReg; ir_op *get_op_EndReg (void) { return op_EndReg; }
ir_op *op_EndExcept; ir_op *get_op_EndExcept (void) { return op_EndExcept; }
-ir_op *op_FuncCall; ir_op *get_op_FuncCall (void) { return op_FuncCall; }
+ir_op *op_NoMem; ir_op *get_op_NoMem (void) { return op_NoMem; }
ir_op *
op_Sel = new_ir_op(iro_Sel, "Sel", op_pin_state_floats, L, oparity_any, -1, sizeof(sel_attr));
op_InstOf = new_ir_op(iro_InstOf, "InstOf", op_pin_state_floats, L, oparity_any, -1, sizeof(sel_attr));
- op_Call = new_ir_op(iro_Call, "Call", op_pin_state_pinned, L|F, oparity_variable, -1, sizeof(call_attr));
+ op_Call = new_ir_op(iro_Call, "Call", op_pin_state_mem_pinned, L|F, oparity_variable, -1, sizeof(call_attr));
op_Add = new_ir_op(iro_Add, "Add", op_pin_state_floats, C, oparity_binary, 0, 0);
op_Minus = new_ir_op(iro_Minus, "Minus", op_pin_state_floats, 0, oparity_unary, 0, 0);
op_Sub = new_ir_op(iro_Sub, "Sub", op_pin_state_floats, L, oparity_binary, 0, 0);
op_EndReg = new_ir_op(iro_EndReg, "EndReg", op_pin_state_pinned, X|I, oparity_any, -1, sizeof(end_attr));
op_EndExcept = new_ir_op(iro_EndExcept, "EndExcept", op_pin_state_pinned, X|I, oparity_any, -1, sizeof(end_attr));
- op_FuncCall = new_ir_op(iro_FuncCall, "FuncCall", op_pin_state_floats, L, oparity_any, -1, sizeof(call_attr));
+ op_NoMem = new_ir_op(iro_NoMem, "NoMem", op_pin_state_pinned, 0, oparity_zero, -1, 0);
#undef Y
#undef F
free_ir_op (op_EndReg ); op_EndReg = NULL;
free_ir_op (op_EndExcept); op_EndExcept = NULL;
- free_ir_op (op_FuncCall ); op_FuncCall = NULL;
+ free_ir_op (op_NoMem ); op_NoMem = NULL;
}
/* Returns the string for the opcode. */
iro_Load, iro_Store, iro_Alloc, iro_Free, iro_Sync,
iro_Proj, iro_Tuple, iro_Id, iro_Bad, iro_Confirm,
iro_Unknown, iro_Filter, iro_Break, iro_CallBegin, iro_EndReg, iro_EndExcept,
- iro_FuncCall,
+ iro_NoMem,
iro_MaxOpcode
} opcode;
extern ir_op *op_EndReg; ir_op *get_op_EndReg (void);
extern ir_op *op_EndExcept; ir_op *get_op_EndExcept (void);
-extern ir_op *op_FuncCall; ir_op *get_op_FuncCall (void);
+extern ir_op *op_NoMem; ir_op *get_op_NoMem (void);
/** Returns the ident for the opcode name */
ident *get_op_ident(ir_op *op);
typedef enum {
op_pin_state_floats = 0, /**< Nodes of this opcode can be placed in any basic block. */
op_pin_state_pinned, /**< Nodes must remain in this basic block. */
- op_pin_state_exc_pinned /**< Node must be remain in this basic block if it can throw an
+ op_pin_state_exc_pinned, /**< Node must be remain in this basic block if it can throw an
exception, else can float. Used internally. */
+ op_pin_state_mem_pinned, /**< Node must be remain in this basic block if it can throw an
+ exception or uses memory, else can float. Used internally. */
} op_pin_state;
/** gets pinned state of an opcode */
* Transform a Div/Mod/DivMod with a non-zero constant. Must be
* done here instead of equivalent node because it creates new
* nodes.
- * Removes the exceptions and routes the memory to the initial mem.
+ * Removes the exceptions and routes the memory to the NoMem node.
*
* Further, it optimizes jump tables by removing all impossible cases.
*/
else {
/* the memory Proj can be removed */
ir_node *res = get_Div_mem(n);
- set_Div_mem(n, get_irg_initial_mem(current_ir_graph));
+ set_Div_mem(n, get_irg_no_mem(current_ir_graph));
if (proj_nr == pn_Div_M)
return res;
else {
/* the memory Proj can be removed */
ir_node *res = get_Mod_mem(n);
- set_Mod_mem(n, get_irg_initial_mem(current_ir_graph));
+ set_Mod_mem(n, get_irg_no_mem(current_ir_graph));
if (proj_nr == pn_Mod_M)
return res;
}
else {
/* the memory Proj can be removed */
ir_node *res = get_DivMod_mem(n);
- set_DivMod_mem(n, get_irg_initial_mem(current_ir_graph));
+ set_DivMod_mem(n, get_irg_no_mem(current_ir_graph));
if (proj_nr == pn_DivMod_M)
return res;
}
return (get_irn_call_attr(a) != get_irn_call_attr(b));
}
-/** Compares the attributes of two FuncCall nodes. */
-static int node_cmp_attr_FuncCall(ir_node *a, ir_node *b)
-{
- return (get_irn_funccall_attr(a) != get_irn_funccall_attr(b));
-}
-
/** Compares the attributes of two Sel nodes. */
static int node_cmp_attr_Sel(ir_node *a, ir_node *b)
{
CASE(Free);
CASE(SymConst);
CASE(Call);
- CASE(FuncCall);
CASE(Sel);
CASE(Phi);
CASE(Cast);
break;
- case iro_FuncCall:
- ASSERT_AND_RET_DBG(
- ((proj == pn_Call_M_regular && mode == mode_M) ||
- (proj == pn_Call_X_except && mode == mode_X) ||
- (proj == pn_Call_T_result && mode == mode_T) ||
- (proj == pn_Call_M_except && mode == mode_M) ||
- (proj == pn_Call_P_value_res_base && mode == mode_P)),
- "wrong Proj from FuncCall", 0,
- show_proj_failure(p);
- );
- break;
-
case iro_Quot:
ASSERT_AND_RET_DBG(
((proj == pn_Quot_M && mode == mode_M) ||
}
break;
- case iro_FuncCall:
- {
- ASSERT_AND_RET(
- (proj >= 0 && mode_is_data(mode)),
- "wrong Proj from Proj from FuncCall", 0);
- mt = get_FuncCall_type(pred);
- ASSERT_AND_RET(
- (proj < get_method_n_ress(mt)),
- "More Projs for results than results in type.", 0);
- if ((mode_is_reference(mode)) && is_compound_type(get_method_res_type(mt, proj)))
- /* value result */ break;
-
- ASSERT_AND_RET(
- (mode == get_type_mode(get_method_res_type(mt, proj))),
- "Mode of Proj from FuncCall doesn't match mode of result type.", 0);
- }
- break;
-
case iro_Tuple:
/* We don't test */
break;