*/
static void ia32_init(void)
{
- ir_mode *mode_long_long;
- ir_mode *mode_unsigned_long_long;
- ir_type *type_long_long;
- ir_type *type_unsigned_long_long;
+ ir_mode *mode_long_long;
+ ir_mode *mode_unsigned_long_long;
+ ir_type *type_long_long;
+ ir_type *type_unsigned_long_long;
ia32_setup_cg_config();
}
ia32_register_init();
+ obstack_init(&opcodes_obst);
ia32_create_opcodes(&ia32_irn_ops);
}
between_type = NULL;
}
ia32_free_opcodes();
+ obstack_free(&opcodes_obst, NULL);
}
/**
#include "ia32_new_nodes.h"
#include "gen_ia32_regalloc_if.h"
+struct obstack opcodes_obst;
+
/**
* Dumper interface for dumping ia32 nodes in vcg.
* @param n the node to dump
new_info->flags = old_info->flags;
}
+static void ia32_init_op(ir_op *op, unsigned latency)
+{
+ ia32_op_attr_t *attr = OALLOCZ(&opcodes_obst, ia32_op_attr_t);
+ attr->latency = latency;
+ set_op_attr(op, attr);
+}
+
/* Include the generated constructor functions */
#include "gen_ia32_new_nodes.c.inl"
}
$n_opcodes++;
- $temp = "\top_$op = new_ir_op(cur_opcode + iro_$op, \"$op\", op_pin_state_".$n{"state"}.", $op_flags";
+ $temp = "\top = new_ir_op(cur_opcode + iro_$op, \"$op\", op_pin_state_".$n{"state"}.", $op_flags";
$temp .= ", ".translate_arity($arity).", 0, ${attr_size}, &ops);\n";
push(@obst_new_irop, $temp);
if ($is_fragile) {
- push(@obst_new_irop, "\tir_op_set_memory_index(op_${op}, n_${op}_mem);\n");
- push(@obst_new_irop, "\tir_op_set_fragile_indices(op_${op}, pn_${op}_X_regular, pn_${op}_X_except);\n");
+ push(@obst_new_irop, "\tir_op_set_memory_index(op, n_${op}_mem);\n");
+ push(@obst_new_irop, "\tir_op_set_fragile_indices(op, pn_${op}_X_regular, pn_${op}_X_except);\n");
}
- push(@obst_new_irop, "\tset_op_tag(op_$op, $arch\_op_tag);\n");
- if(defined($default_op_attr_type)) {
- push(@obst_new_irop, "\tattr = &attrs[iro_$op];\n");
- if(defined($n{op_attr_init})) {
- push(@obst_new_irop, "\t".$n{op_attr_init}."\n");
- }
- push(@obst_new_irop, "\tset_op_attr(op_$op, attr);\n");
+ push(@obst_new_irop, "\tset_op_tag(op, $arch\_op_tag);\n");
+ if(defined($n{op_attr_init})) {
+ push(@obst_new_irop, "\t".$n{op_attr_init}."\n");
}
+ push(@obst_new_irop, "\top_${op} = op;\n");
push(@obst_free_irop, "\tfree_ir_op(op_$op); op_$op = NULL;\n");
void $arch\_create_opcodes(const arch_irn_ops_t *be_ops)
{
ir_op_ops ops;
- int cur_opcode;
-ENDOFMAIN
-
- if (defined($default_op_attr_type)) {
- print OUT "\t$default_op_attr_type *attr, *attrs;\n";
- }
-
-print OUT<<ENDOFMAIN;
-
- cur_opcode = get_next_ir_opcodes(iro_$arch\_last);
+ ir_op *op;
+ int cur_opcode = get_next_ir_opcodes(iro_$arch\_last);
$arch\_opcode_start = cur_opcode;
ENDOFMAIN
- if (defined($default_op_attr_type)) {
- print OUT "\tattrs = XMALLOCNZ(${default_op_attr_type}, iro_${arch}_last);\n";
- }
-
print OUT @obst_new_irop;
print OUT "\n";
print OUT "\t$arch\_register_additional_opcodes(cur_opcode);\n" if (defined($additional_opcodes));