#define O irop_flag_machine_op
#define R (irop_flag_user << 0)
- ir_op_ops ops;
- int cur_opcode = get_next_ir_opcodes(iro_$arch\_last);
+ ir_op_ops ops;
+ int cur_opcode;
+ static int run_once = 0;
+
+ if (run_once)
+ return;
+ run_once = 1;
+
+ cur_opcode = get_next_ir_opcodes(iro_$arch\_last);
$arch\_opcode_start = cur_opcode;
ENDOFMAIN
my $class_mode;
+# assure, the initialization is done only once
+push(@obst_reginit, " static int run_once = 0;\n");
+push(@obst_reginit, "\n");
+push(@obst_reginit, " if (run_once)\n return;\n");
+push(@obst_reginit, " run_once = 1;\n");
+
# generate register type and class variable, init function and default requirements
foreach my $class_name (keys(%reg_classes)) {
my @class = @{ $reg_classes{"$class_name"} };