Commit 20c1182a authored by Andreas Schösser's avatar Andreas Schösser
Browse files

Added code to run some initialization routines only once, even if they were called several times.

parent 174a697d
......@@ -465,8 +465,15 @@ void $arch\_create_opcodes(void) {
#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
......
......@@ -108,6 +108,12 @@ push(@obst_classdef, "enum reg_classes {\n");
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"} };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment