X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firop.c;h=41013433384d3fc97e5bb5a5724325d58f55fd01;hb=20a054e20083e0b0e996aceabf561254c663277a;hp=0c48bf937c3c1552b45d50b0f7ee09701291276d;hpb=94ad692c1439dc0b3f48e1d2de3bf662916d7343;p=libfirm diff --git a/ir/ir/irop.c b/ir/ir/irop.c index 0c48bf937..410134333 100644 --- a/ir/ir/irop.c +++ b/ir/ir/irop.c @@ -65,6 +65,7 @@ ir_op *op_Add; ir_op *get_op_Add (void) { return op_Add; } ir_op *op_Sub; ir_op *get_op_Sub (void) { return op_Sub; } ir_op *op_Minus; ir_op *get_op_Minus (void) { return op_Minus; } ir_op *op_Mul; ir_op *get_op_Mul (void) { return op_Mul; } +ir_op *op_Mulh; ir_op *get_op_Mulh (void) { return op_Mulh; } ir_op *op_Quot; ir_op *get_op_Quot (void) { return op_Quot; } ir_op *op_DivMod; ir_op *get_op_DivMod (void) { return op_DivMod; } ir_op *op_Div; ir_op *get_op_Div (void) { return op_Div; } @@ -116,6 +117,7 @@ ir_op *op_Bound; ir_op *get_op_Bound (void) { return op_Bound; } ir_op *op_Pin; ir_op *get_op_Pin (void) { return op_Pin; } ir_op *op_ASM; ir_op *get_op_ASM (void) { return op_ASM; } +ir_op *op_Anchor; ir_op *get_op_Anchor (void) { return op_Anchor; } /* * Copies all attributes stored in the old node to the new node. @@ -177,6 +179,19 @@ filter_copy_attr(const ir_node *old_node, ir_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) { + 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); +} + /** * Sets the default copy_attr operation for an ir_ops * @@ -187,15 +202,23 @@ filter_copy_attr(const ir_node *old_node, ir_node *new_node) { * The operations. */ static ir_op_ops *firm_set_default_copy_attr(ir_opcode code, ir_op_ops *ops) { - if (code == iro_Call) + switch(code) { + case iro_Call: ops->copy_attr = call_copy_attr; - else if (code == iro_Block) + break; + case iro_Block: ops->copy_attr = block_copy_attr; - else if (code == iro_Phi) + break; + case iro_Phi: ops->copy_attr = phi_copy_attr; - else if (code == iro_Filter) + break; + case iro_Filter: ops->copy_attr = filter_copy_attr; - else { + break; + case iro_ASM: + ops->copy_attr = ASM_copy_attr; + break; + default: /* not allowed to be NULL */ if (! ops->copy_attr) ops->copy_attr = default_copy_attr; @@ -205,7 +228,7 @@ static ir_op_ops *firm_set_default_copy_attr(ir_opcode code, ir_op_ops *ops) { /* Creates a new ir operation. */ ir_op * -new_ir_op(ir_opcode code, const char *name, op_pin_state p, +new_ir_op(unsigned code, const char *name, op_pin_state p, unsigned flags, op_arity opar, int op_index, size_t attr_size, const ir_op_ops *ops) { @@ -278,9 +301,10 @@ init_op(void) op_Call = new_ir_op(iro_Call, "Call", op_pin_state_mem_pinned, F, oparity_variable, -1, sizeof(call_attr), NULL); op_Add = new_ir_op(iro_Add, "Add", op_pin_state_floats, C, oparity_binary, 0, 0, NULL); - op_Minus = new_ir_op(iro_Minus, "Minus", op_pin_state_floats, N, oparity_unary, 0, 0, NULL); op_Sub = new_ir_op(iro_Sub, "Sub", op_pin_state_floats, N, oparity_binary, 0, 0, NULL); + op_Minus = new_ir_op(iro_Minus, "Minus", op_pin_state_floats, N, oparity_unary, 0, 0, NULL); op_Mul = new_ir_op(iro_Mul, "Mul", op_pin_state_floats, C, oparity_binary, 0, 0, NULL); + op_Mulh = new_ir_op(iro_Mulh, "Mulh", op_pin_state_floats, C, oparity_binary, 0, 0, NULL); op_Quot = new_ir_op(iro_Quot, "Quot", op_pin_state_exc_pinned, F, oparity_binary, 1, sizeof(divmod_attr), NULL); op_DivMod = new_ir_op(iro_DivMod, "DivMod", op_pin_state_exc_pinned, F, oparity_binary, 1, sizeof(divmod_attr), NULL); op_Div = new_ir_op(iro_Div, "Div", op_pin_state_exc_pinned, F, oparity_binary, 1, sizeof(divmod_attr), NULL); @@ -335,6 +359,8 @@ init_op(void) /* HMM: may contain branches so X|Y */ op_ASM = new_ir_op(iro_ASM, "ASM", op_pin_state_mem_pinned, K|X|Y, oparity_variable, -1, sizeof(asm_attr), NULL); + op_Anchor = new_ir_op(iro_Anchor, "Anchor", op_pin_state_pinned, N, oparity_variable, -1, 0, NULL); + #undef S #undef H #undef Y @@ -366,6 +392,7 @@ void finish_op(void) { free_ir_op (op_Minus ); op_Minus = NULL; free_ir_op (op_Sub ); op_Sub = NULL; free_ir_op (op_Mul ); op_Mul = NULL; + free_ir_op (op_Mulh ); op_Mulh = NULL; free_ir_op (op_Quot ); op_Quot = NULL; free_ir_op (op_DivMod ); op_DivMod = NULL; free_ir_op (op_Div ); op_Div = NULL; @@ -416,6 +443,8 @@ void finish_op(void) { free_ir_op (op_Bound ); op_Bound = NULL; free_ir_op (op_Pin ); op_Pin = NULL; + free_ir_op (op_ASM ); op_ASM = NULL; + free_ir_op (op_Anchor ); op_Anchor = NULL; } /* Returns the string for the opcode. */ @@ -423,7 +452,7 @@ const char *get_op_name (const ir_op *op) { return get_id_str(op->name); } /* get_op_name */ -ir_opcode (get_op_code)(const ir_op *op){ +unsigned (get_op_code)(const ir_op *op){ return _get_op_code(op); } /* get_op_code */