Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
9022c59e
Commit
9022c59e
authored
Jun 16, 2010
by
Matthias Braun
Browse files
fix some bugs that prevented repeated calling of ir_init and ir_finish
[r27628]
parent
36a16c27
Changes
6
Hide whitespace changes
Inline
Side-by-side
ir/be/becopystat.c
View file @
9022c59e
...
...
@@ -126,8 +126,14 @@ void be_init_copystat(void)
BE_REGISTER_MODULE_DESTRUCTOR
(
be_quit_copystat
);
void
be_quit_copystat
(
void
)
{
ir_nodeset_del
(
all_phi_nodes
);
ir_nodeset_del
(
all_copy_nodes
);
if
(
all_phi_nodes
!=
NULL
)
{
ir_nodeset_del
(
all_phi_nodes
);
all_phi_nodes
=
NULL
;
}
if
(
all_copy_nodes
!=
NULL
)
{
ir_nodeset_del
(
all_copy_nodes
);
all_copy_nodes
=
NULL
;
}
}
/**
...
...
ir/common/firm.c
View file @
9022c59e
...
...
@@ -127,9 +127,9 @@ void ir_init(const firm_parameter_t *param)
later. */
init_irprog_2
();
/* Initialize the type module and construct some idents needed. */
f
ir
m
_init_type
();
ir_init_type
();
/* initialize the entity module */
f
ir
m
_init_entity
();
ir_init_entity
();
/* class cast optimization */
firm_init_class_casts_opt
();
/* memory disambiguation */
...
...
@@ -166,6 +166,9 @@ void ir_finish(void)
free_ir_prog
();
ir_finish_entity
();
ir_finish_type
();
finish_tarval
();
finish_mode
();
finish_tpop
();
...
...
ir/tr/entity.c
View file @
9022c59e
...
...
@@ -239,7 +239,7 @@ ir_entity *copy_entity_name(ir_entity *old, ident *new_name)
void
free_entity
(
ir_entity
*
ent
)
{
if
(
!
is_Array_type
(
ent
->
owner
))
if
(
ent
->
owner
!=
NULL
&&
!
is_Array_type
(
ent
->
owner
))
remove_compound_member
(
ent
->
owner
,
ent
);
assert
(
ent
&&
ent
->
kind
==
k_entity
);
...
...
@@ -996,21 +996,23 @@ int entity_has_definition(const ir_entity *entity)
||
entity_has_compound_ent_values
(
entity
);
}
void
f
ir
m
_init_entity
(
void
)
void
ir_init_entity
(
void
)
{
symconst_symbol
sym
;
assert
(
firm_unknown_type
&&
"Call init_type() before firm_init_entity()!"
);
assert
(
!
unknown_entity
&&
"Call firm_init_entity() only once!"
);
unknown_entity
=
new_d_entity
(
NULL
,
new_id_from_str
(
UNKNOWN_ENTITY_NAME
),
firm_unknown_type
,
NULL
);
set_entity_visibility
(
unknown_entity
,
ir_visibility_external
);
set_entity_ld_ident
(
unknown_entity
,
get_entity_ident
(
unknown_entity
));
}
current_ir_graph
=
get_const_code_irg
();
sym
.
entity_p
=
unknown_entity
;
void
ir_finish_entity
(
void
)
{
if
(
unknown_entity
!=
NULL
)
{
free_entity
(
unknown_entity
);
unknown_entity
=
NULL
;
}
}
ir_allocation
get_entity_allocation
(
const
ir_entity
*
entity
)
...
...
ir/tr/entity_t.h
View file @
9022c59e
...
...
@@ -172,7 +172,9 @@ struct ir_entity {
};
/** Initialize the entity module. */
void
firm_init_entity
(
void
);
void
ir_init_entity
(
void
);
/** Cleanup entity module */
void
ir_finish_entity
(
void
);
/* ----------------------- inline functions ------------------------ */
static
inline
int
_is_entity
(
const
void
*
thing
)
...
...
ir/tr/type.c
View file @
9022c59e
...
...
@@ -85,7 +85,7 @@ ir_type *get_unknown_type(void)
static
ident
*
value_params_suffix
=
NULL
;
static
ident
*
value_ress_suffix
=
NULL
;
void
f
ir
m
_init_type
(
void
)
void
ir_init_type
(
void
)
{
value_params_suffix
=
new_id_from_str
(
VALUE_PARAMS_SUFFIX
);
value_ress_suffix
=
new_id_from_str
(
VALUE_RESS_SUFFIX
);
...
...
@@ -106,6 +106,24 @@ void firm_init_type(void)
remove_irp_type
(
firm_unknown_type
);
}
void
ir_finish_type
(
void
)
{
if
(
firm_none_type
!=
NULL
)
{
free_type
(
firm_none_type
);
firm_none_type
=
NULL
;
}
if
(
firm_code_type
!=
NULL
)
{
free_type
(
firm_code_type
);
firm_code_type
=
NULL
;
}
if
(
firm_unknown_type
!=
NULL
)
{
free_type
(
firm_unknown_type
);
firm_unknown_type
=
NULL
;
}
value_params_suffix
=
NULL
;
value_ress_suffix
=
NULL
;
}
/** the global type visited flag */
ir_visited_t
firm_type_visited
;
...
...
ir/tr/type_t.h
View file @
9022c59e
...
...
@@ -286,10 +286,11 @@ int get_class_dfn(const ir_type *clss);
void
add_compound_member
(
ir_type
*
compound
,
ir_entity
*
entity
);
void
remove_compound_member
(
ir_type
*
compound
,
ir_entity
*
entity
);
/**
* Initialize the type module.
*/
void
firm_init_type
(
void
);
/** Initialize the type module. */
void
ir_init_type
(
void
);
/** free internal datastructures of type module */
void
ir_finish_type
(
void
);
/** Clone an existing method type.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment