Commit d9ebcc50 authored by Matthias Braun's avatar Matthias Braun
Browse files

remove strange init_once/inited checks from arch_init functions. Calling it...

remove strange init_once/inited checks from arch_init functions. Calling it twice is invalid (and crashs anyway)

[r28152]
parent 05ebe189
......@@ -162,14 +162,7 @@ static TEMPLATE_isa_t TEMPLATE_isa_template = {
*/
static arch_env_t *TEMPLATE_init(FILE *outfile)
{
static int run_once = 0;
TEMPLATE_isa_t *isa;
if (run_once)
return NULL;
run_once = 1;
isa = XMALLOC(TEMPLATE_isa_t);
TEMPLATE_isa_t *isa = XMALLOC(TEMPLATE_isa_t);
memcpy(isa, &TEMPLATE_isa_template, sizeof(*isa));
be_emit_init(outfile);
......@@ -180,8 +173,6 @@ static arch_env_t *TEMPLATE_init(FILE *outfile)
return &isa->base;
}
/**
* Closes the output file and frees the ISA structure.
*/
......
......@@ -283,14 +283,7 @@ static amd64_isa_t amd64_isa_template = {
*/
static arch_env_t *amd64_init(FILE *outfile)
{
static int run_once = 0;
amd64_isa_t *isa;
if(run_once)
return NULL;
run_once = 1;
isa = XMALLOC(amd64_isa_t);
amd64_isa_t *isa = XMALLOC(amd64_isa_t);
memcpy(isa, &amd64_isa_template, sizeof(*isa));
be_emit_init(outfile);
......
......@@ -441,13 +441,7 @@ static arm_isa_t arm_isa_template = {
*/
static arch_env_t *arm_init(FILE *file_handle)
{
static int inited = 0;
arm_isa_t *isa;
if (inited)
return NULL;
isa = XMALLOC(arm_isa_t);
arm_isa_t *isa = XMALLOC(arm_isa_t);
memcpy(isa, &arm_isa_template, sizeof(*isa));
arm_register_init();
......@@ -464,7 +458,6 @@ static arch_env_t *arm_init(FILE *file_handle)
be_emit_irprintf("%stext0:\n", be_gas_get_private_prefix());
be_emit_write_line();
inited = 1;
return &isa->base;
}
......
......@@ -1518,17 +1518,11 @@ static void init_asm_constraints(void)
*/
static arch_env_t *ia32_init(FILE *file_handle)
{
static int inited = 0;
ia32_isa_t *isa;
ia32_isa_t *isa = XMALLOC(ia32_isa_t);
int i, n;
if (inited)
return NULL;
inited = 1;
set_tarval_output_modes();
isa = XMALLOC(ia32_isa_t);
memcpy(isa, &ia32_isa_template, sizeof(*isa));
if (ia32_mode_fpcw == NULL) {
......
......@@ -477,14 +477,7 @@ static void sparc_handle_intrinsics(void)
*/
static arch_env_t *sparc_init(FILE *outfile)
{
static int run_once = 0;
sparc_isa_t *isa;
if (run_once)
return NULL;
run_once = 1;
isa = XMALLOC(sparc_isa_t);
sparc_isa_t *isa = XMALLOC(sparc_isa_t);
memcpy(isa, &sparc_isa_template, sizeof(*isa));
isa->constants = pmap_create();
......
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