X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firop.c;h=450dd475d33d98d5e637c5c2f087c5a752063f57;hb=67553de44f77855233fb2dfb0251eb9098f2b467;hp=4392a4b76e85318cc77e9a57dc0db947616dda6d;hpb=abbf9492df1993d211412ba520feb81de0688c2a;p=libfirm diff --git a/ir/ir/irop.c b/ir/ir/irop.c index 4392a4b76..450dd475d 100644 --- a/ir/ir/irop.c +++ b/ir/ir/irop.c @@ -33,7 +33,7 @@ #include "irbackedge_t.h" #include "iropt_t.h" -#include "irvrfy_t.h" +#include "irverify_t.h" #include "reassoc_t.h" #include "xmalloc.h" @@ -47,9 +47,11 @@ static unsigned next_iro = iro_MaxOpcode; * Copies all attributes stored in the old node to the new node. * Assumes both have the same opcode and sufficient size. */ -void default_copy_attr(const ir_node *old_node, ir_node *new_node) +void default_copy_attr(ir_graph *irg, const ir_node *old_node, + ir_node *new_node) { unsigned size = firm_add_node_size; + (void) irg; assert(get_irn_op(old_node) == get_irn_op(new_node)); memcpy(&new_node->attr, &old_node->attr, get_op_attr_size(get_irn_op(old_node))); @@ -58,65 +60,60 @@ void default_copy_attr(const ir_node *old_node, ir_node *new_node) /* copy additional node data */ memcpy(get_irn_data(new_node, void, size), get_irn_data(old_node, void, size), size); } -} /* default_copy_attr */ +} /** * Copies all Call attributes stored in the old node to the new node. */ -static void call_copy_attr(const ir_node *old_node, ir_node *new_node) +static void call_copy_attr(ir_graph *irg, const ir_node *old_node, + ir_node *new_node) { - default_copy_attr(old_node, new_node); + default_copy_attr(irg, old_node, new_node); remove_Call_callee_arr(new_node); -} /* call_copy_attr */ +} /** * Copies all Block attributes stored in the old node to the new node. */ -static void block_copy_attr(const ir_node *old_node, ir_node *new_node) +static void block_copy_attr(ir_graph *irg, const ir_node *old_node, + ir_node *new_node) { - ir_graph *irg = current_ir_graph; - - default_copy_attr(old_node, new_node); - new_node->attr.block.phis = NULL; - new_node->attr.block.cg_backedge = NULL; - new_node->attr.block.backedge = new_backedge_arr(irg->obst, get_irn_arity(new_node)); + default_copy_attr(irg, old_node, new_node); + new_node->attr.block.irg.irg = irg; + new_node->attr.block.phis = NULL; + new_node->attr.block.cg_backedge = NULL; + new_node->attr.block.backedge = new_backedge_arr(irg->obst, get_irn_arity(new_node)); + 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; INIT_LIST_HEAD(&new_node->attr.block.succ_head); -} /* block_copy_attr */ +} /** * Copies all phi attributes stored in old node to the new node */ -static void phi_copy_attr(const ir_node *old_node, ir_node *new_node) +static void phi_copy_attr(ir_graph *irg, const ir_node *old_node, + ir_node *new_node) { - ir_graph *irg = current_ir_graph; - - default_copy_attr(old_node, new_node); + default_copy_attr(irg, old_node, new_node); new_node->attr.phi.next = NULL; new_node->attr.phi.u.backedge = new_backedge_arr(irg->obst, get_irn_arity(new_node)); } -/** - * Copies all filter attributes stored in old node to the new node - */ -static void filter_copy_attr(const ir_node *old_node, ir_node *new_node) -{ - ir_graph *irg = current_ir_graph; - - default_copy_attr(old_node, new_node); - new_node->attr.filter.backedge = new_backedge_arr(irg->obst, get_irn_arity(new_node)); -} - /** * Copies all ASM attributes stored in old node to the new node */ -static void ASM_copy_attr(const ir_node *old_node, ir_node *new_node) +static void ASM_copy_attr(ir_graph *irg, const ir_node *old_node, + ir_node *new_node) { - ir_graph *irg = current_ir_graph; - - default_copy_attr(old_node, new_node); - new_node->attr.assem.inputs = DUP_ARR_D(ir_asm_constraint, irg->obst, old_node->attr.assem.inputs); - new_node->attr.assem.outputs = DUP_ARR_D(ir_asm_constraint, irg->obst, old_node->attr.assem.outputs); - new_node->attr.assem.clobber = DUP_ARR_D(ir_asm_constraint, irg->obst, old_node->attr.assem.clobber); + 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(ident*, irg->obst, old_node->attr.assem.clobbers); } /** @@ -128,7 +125,7 @@ static void ASM_copy_attr(const ir_node *old_node, ir_node *new_node) * @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: @@ -140,9 +137,6 @@ static ir_op_ops *firm_set_default_copy_attr(ir_opcode code, ir_op_ops *ops) case iro_Phi: ops->copy_attr = phi_copy_attr; break; - case iro_Filter: - ops->copy_attr = filter_copy_attr; - break; case iro_ASM: ops->copy_attr = ASM_copy_attr; break; @@ -270,7 +264,7 @@ const ir_op_ops *(get_op_ops)(const ir_op *op) irop_flags get_op_flags(const ir_op *op) { - return op->flags; + return (irop_flags)op->flags; } #include "gen_irop.c.inl"