new_node->attr.block.block_visited = 0;
memset(&new_node->attr.block.dom, 0, sizeof(new_node->attr.block.dom));
memset(&new_node->attr.block.pdom, 0, sizeof(new_node->attr.block.pdom));
- /* TODO: we should probably create a new entity. But we somehow have to
- * patch the stuff at the same time */
- new_node->attr.block.entity = NULL;
- new_node->attr.block.phis = NULL;
+ /* It should be safe to copy the entity here, as it has no back-link to the old block.
+ * It serves just as a label number, so copying a labeled block results in an exact copy.
+ * This is at least what we need for DCE to work. */
+ new_node->attr.block.entity = old_node->attr.block.entity;
+ new_node->attr.block.phis = NULL;
INIT_LIST_HEAD(&new_node->attr.block.succ_head);
}
default_copy_attr(irg, old_node, new_node);
new_node->attr.assem.input_constraints = DUP_ARR_D(ir_asm_constraint, irg->obst, old_node->attr.assem.input_constraints);
new_node->attr.assem.output_constraints = DUP_ARR_D(ir_asm_constraint, irg->obst, old_node->attr.assem.output_constraints);
- new_node->attr.assem.clobbers = DUP_ARR_D(ir_asm_constraint, irg->obst, old_node->attr.assem.clobbers);
+ new_node->attr.assem.clobbers = DUP_ARR_D(ident*, irg->obst, old_node->attr.assem.clobbers);
}
/**
* @return
* The operations.
*/
-static ir_op_ops *firm_set_default_copy_attr(ir_opcode code, ir_op_ops *ops)
+static ir_op_ops *firm_set_default_copy_attr(unsigned code, ir_op_ops *ops)
{
switch (code) {
case iro_Call:
ops->copy_attr = default_copy_attr;
}
return ops;
-} /* firm_set_default_copy_attr */
+}
/* Creates a new ir operation. */
ir_op *new_ir_op(unsigned code, const char *name, op_pin_state p,
res->tag = 0;
if (ops)
- memcpy(&res->ops, ops, sizeof(res->ops));
+ res->ops = *ops;
else /* no given ops, set all operations to NULL */
memset(&res->ops, 0, sizeof(res->ops));
firm_set_default_operations(code, &res->ops);
firm_set_default_copy_attr(code, &res->ops);
- firm_set_default_verifyer(code, &res->ops);
+ firm_set_default_verifier(code, &res->ops);
firm_set_default_reassoc(code, &res->ops);
add_irp_opcode(res);
hook_new_ir_op(res);
return res;
-} /* new_ir_op */
+}
void free_ir_op(ir_op *code)
{
remove_irp_opcode(code);
free(code);
-} /* free_ir_op */
+}
+
+void ir_op_set_fragile_indices(ir_op *op, int fragile_mem_index,
+ int pn_x_regular, int pn_x_except)
+{
+ op->fragile_mem_index = fragile_mem_index;
+ op->pn_x_regular = pn_x_regular;
+ op->pn_x_except = pn_x_except;
+}
/* Returns the string for the opcode. */
const char *get_op_name (const ir_op *op)
{
return get_id_str(op->name);
-} /* get_op_name */
+}
unsigned (get_op_code)(const ir_op *op)
{
return _get_op_code(op);
-} /* get_op_code */
+}
ident *(get_op_ident)(const ir_op *op)
{
return _get_op_ident(op);
-} /* get_op_ident */
+}
const char *get_op_pin_state_name(op_pin_state s)
{
#undef XXX
}
return "<none>";
-} /* get_op_pin_state_name */
+}
op_pin_state (get_op_pinned)(const ir_op *op)
{
return _get_op_pinned(op);
-} /* get_op_pinned */
+}
/* Sets op_pin_state_pinned in the opcode. Setting it to floating has no effect
for Phi, Block and control flow nodes. */
{
if (op == op_Block || op == op_Phi || is_op_cfopcode(op)) return;
op->pin_state = pinned;
-} /* set_op_pinned */
+}
/* retrieve the next free opcode */
unsigned get_next_ir_opcode(void)
{
return next_iro++;
-} /* get_next_ir_opcode */
+}
/* Returns the next free n IR opcode number, allows to register a bunch of user ops */
unsigned get_next_ir_opcodes(unsigned num)
unsigned base = next_iro;
next_iro += num;
return base;
-} /* get_next_ir_opcodes */
+}
/* Returns the generic function pointer from an ir operation. */
op_func (get_generic_function_ptr)(const ir_op *op)
{
return _get_generic_function_ptr(op);
-} /* get_generic_function_ptr */
+}
/* Store a generic function pointer into an ir operation. */
void (set_generic_function_ptr)(ir_op *op, op_func func)
{
_set_generic_function_ptr(op, func);
-} /* set_generic_function_ptr */
+}
/* Returns the ir_op_ops of an ir_op. */
const ir_op_ops *(get_op_ops)(const ir_op *op)
{
return _get_op_ops(op);
-} /* get_op_ops */
+}
irop_flags get_op_flags(const ir_op *op)
{
- return op->flags;
+ return (irop_flags)op->flags;
}
#include "gen_irop.c.inl"