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
cd2726e0
Commit
cd2726e0
authored
Jan 24, 2014
by
Christoph Mallon
Browse files
Remove union type_or_ent.
parent
89330ecd
Changes
7
Hide whitespace changes
Inline
Side-by-side
include/libfirm/typerep.h
View file @
cd2726e0
...
...
@@ -1986,18 +1986,13 @@ FIRM_API ir_entity *frame_alloc_area(ir_type *frame_type, int size,
*/
typedef
int
(
compare_types_func_t
)(
const
void
*
tp1
,
const
void
*
tp2
);
/** A data type to treat types and entities as the same. */
typedef
union
{
ir_type
*
typ
;
/**< points to a type */
ir_entity
*
ent
;
/**< points to an entity */
}
type_or_ent
;
/** Type of argument functions for type walkers.
*
* @param tore points to the visited type or entity
* @param type points to the visited type, either this or entity is non-null
* @param entity points to the visited entity, either this or type is non-null
* @param env free environment pointer
*/
typedef
void
type_walk_func
(
type
_or_ent
tore
,
void
*
env
);
typedef
void
type_walk_func
(
ir_
type
*
type
,
ir_entity
*
entity
,
void
*
env
);
/** The class walk function
*
...
...
ir/debug/debugger.c
View file @
cd2726e0
...
...
@@ -669,23 +669,26 @@ typedef struct find_env {
/**
* Type-walker: Find an entity with given number.
*/
static
void
check_ent_nr
(
type
_or_ent
tore
,
void
*
ctx
)
static
void
check_ent_nr
(
ir_
type
*
const
type
,
ir_entity
*
const
entity
,
void
*
const
ctx
)
{
(
void
)
type
;
find_env_t
*
env
=
(
find_env_t
*
)
ctx
;
if
(
is_
entity
(
tore
.
ent
)
&&
get_entity_nr
(
tore
.
ent
)
==
env
->
u
.
nr
)
{
env
->
res
=
tore
.
ent
;
if
(
entity
&&
get_entity_nr
(
ent
ity
)
==
env
->
u
.
nr
)
{
env
->
res
=
ent
ity
;
}
}
/**
* Type-walker: Find an entity with given name.
*/
static
void
check_ent_name
(
type
_or_ent
tore
,
void
*
ctx
)
static
void
check_ent_name
(
ir_
type
*
const
type
,
ir_entity
*
const
entity
,
void
*
const
ctx
)
{
(
void
)
type
;
find_env_t
*
env
=
(
find_env_t
*
)
ctx
;
if
(
is_entity
(
tore
.
ent
)
&&
strcmp
(
get_entity_name
(
tore
.
ent
),
env
->
u
.
name
)
==
0
)
{
env
->
res
=
tore
.
ent
;
if
(
entity
&&
strcmp
(
get_entity_name
(
entity
),
env
->
u
.
name
)
==
0
)
{
env
->
res
=
entity
;
}
}
...
...
@@ -716,13 +719,13 @@ static ir_entity *find_entity_name(const char *name)
/**
* Search methods for a name.
*/
static
void
show_by_name
(
type
_or_ent
tore
,
void
*
env
)
static
void
show_by_name
(
ir_
type
*
const
type
,
ir_entity
*
const
ent
,
void
*
const
env
)
{
ident
*
id
=
(
ident
*
)
env
;
(
void
)
type
;
if
(
is_entity
(
tore
.
ent
))
{
ir_entity
*
ent
=
tore
.
ent
;
ident
*
id
=
(
ident
*
)
env
;
if
(
ent
)
{
if
(
is_method_entity
(
ent
)
&&
get_entity_ident
(
ent
)
==
id
)
{
ir_type
*
owner
=
get_entity_owner
(
ent
);
ir_graph
*
irg
=
get_entity_irg
(
ent
);
...
...
@@ -743,13 +746,13 @@ static void show_by_name(type_or_ent tore, void *env)
/**
* Search methods for a ldname.
*/
static
void
show_by_ldname
(
type
_or_ent
tore
,
void
*
env
)
static
void
show_by_ldname
(
ir_
type
*
const
type
,
ir_entity
*
const
ent
,
void
*
const
env
)
{
ident
*
id
=
(
ident
*
)
env
;
(
void
)
type
;
if
(
is_entity
(
tore
.
ent
))
{
ir_entity
*
ent
=
tore
.
ent
;
ident
*
id
=
(
ident
*
)
env
;
if
(
ent
)
{
if
(
is_method_entity
(
ent
)
&&
get_entity_ld_ident
(
ent
)
==
id
)
{
ir_type
*
owner
=
get_entity_owner
(
ent
);
ir_graph
*
irg
=
get_entity_irg
(
ent
);
...
...
ir/ir/irdump.c
View file @
cd2726e0
...
...
@@ -1593,16 +1593,14 @@ static void dump_entity_initializer(FILE *F, const ir_entity *ent)
/**
* type-walker: Dumps a type or entity and its edges.
*/
static
void
dump_type_info
(
type
_or_ent
tore
,
void
*
env
)
static
void
dump_type_info
(
ir_
type
*
const
tp
,
ir_entity
*
const
ent
,
void
*
const
env
)
{
FILE
*
F
=
(
FILE
*
)
env
;
size_t
i
=
0
;
/* to shutup gcc */
/* dump this type or entity */
switch
(
get_kind
(
tore
.
ent
))
{
case
k_entity
:
{
ir_entity
*
ent
=
tore
.
ent
;
if
(
ent
)
{
/* The node */
dump_entity_node
(
F
,
ent
);
/* The Edges */
...
...
@@ -1621,10 +1619,7 @@ static void dump_type_info(type_or_ent tore, void *env)
dump_entity_initializer
(
F
,
ent
);
}
}
break
;
}
case
k_type
:
{
ir_type
*
tp
=
tore
.
typ
;
}
else
{
dump_type_node
(
F
,
tp
);
/* and now the edges */
switch
(
get_type_tpop_code
(
tp
))
{
...
...
@@ -1684,28 +1679,23 @@ static void dump_type_info(type_or_ent tore, void *env)
case
tpo_primitive
:
break
;
}
break
;
/* case k_type */
}
default:
printf
(
" *** irdump, dump_type_info(l.%i), faulty type.
\n
"
,
__LINE__
);
}
}
/** For dumping class hierarchies.
* Dumps a class type node and a superclass edge.
*/
static
void
dump_class_hierarchy_node
(
type
_or_ent
tore
,
void
*
ctx
)
static
void
dump_class_hierarchy_node
(
ir_
type
*
const
tp
,
ir_entity
*
const
ent
,
void
*
const
ctx
)
{
FILE
*
F
=
(
FILE
*
)
ctx
;
size_t
i
=
0
;
/* to shutup gcc */
/* dump this type or entity */
switch
(
get_kind
(
tore
.
ent
))
{
case
k_entity
:
{
ir_entity
*
ent
=
tore
.
ent
;
if
(
get_entity_owner
(
ent
)
==
get_glob_type
())
break
;
if
(
ent
)
{
if
(
get_entity_owner
(
ent
)
==
get_glob_type
())
return
;
if
(
!
is_Method_type
(
get_entity_type
(
ent
)))
b
re
ak
;
/* GL */
re
turn
;
/* GL */
if
(
flags
&
ir_dump_flag_entities_in_hierarchy
&&
is_Class_type
(
get_entity_owner
(
ent
)))
{
/* The node */
...
...
@@ -1717,12 +1707,9 @@ static void dump_class_hierarchy_node(type_or_ent tore, void *ctx)
print_ent_ent_edge
(
F
,
get_entity_overwrites
(
ent
,
i
),
ent
,
0
,
ird_color_none
,
ENT_OVERWRITES_EDGE_ATTR
);
}
}
break
;
}
case
k_type
:
{
ir_type
*
tp
=
tore
.
typ
;
}
else
{
if
(
tp
==
get_glob_type
())
b
re
ak
;
re
turn
;
switch
(
get_type_tpop_code
(
tp
))
{
case
tpo_class
:
dump_type_node
(
F
,
tp
);
...
...
@@ -1734,10 +1721,6 @@ static void dump_class_hierarchy_node(type_or_ent tore, void *ctx)
break
;
default:
break
;
}
break
;
/* case k_type */
}
default:
printf
(
" *** irdump, dump_class_hierarchy_node(l.%i), faulty type.
\n
"
,
__LINE__
);
}
}
...
...
ir/lower/lower_calls.c
View file @
cd2726e0
...
...
@@ -809,25 +809,22 @@ static void transform_irg(compound_call_lowering_flags flags, ir_graph *irg)
obstack_free
(
&
env
.
obst
,
NULL
);
}
static
void
lower_method_types
(
type
_or_ent
tore
,
void
*
env
)
static
void
lower_method_types
(
ir_
type
*
const
type
,
ir_entity
*
const
entity
,
void
*
const
env
)
{
const
compound_call_lowering_flags
*
flags
=
(
const
compound_call_lowering_flags
*
)
env
;
/* fix method entities */
if
(
is_entity
(
tore
.
ent
))
{
ir_entity
*
ent
=
tore
.
ent
;
ir_type
*
tp
=
get_entity_type
(
ent
);
ir_type
*
lowered
=
lower_mtp
(
*
flags
,
tp
);
set_entity_type
(
ent
,
lowered
);
if
(
entity
)
{
ir_type
*
tp
=
get_entity_type
(
entity
);
ir_type
*
lowered
=
lower_mtp
(
*
flags
,
tp
);
set_entity_type
(
entity
,
lowered
);
}
else
{
ir_type
*
tp
=
tore
.
typ
;
/* fix pointer to methods */
if
(
is_Pointer_type
(
t
p
))
{
ir_type
*
points_to
=
get_pointer_points_to_type
(
t
p
);
if
(
is_Pointer_type
(
t
ype
))
{
ir_type
*
points_to
=
get_pointer_points_to_type
(
t
ype
);
ir_type
*
lowered_points_to
=
lower_mtp
(
*
flags
,
points_to
);
set_pointer_points_to_type
(
t
p
,
lowered_points_to
);
set_pointer_points_to_type
(
t
ype
,
lowered_points_to
);
}
}
}
...
...
ir/tr/trverify.c
View file @
cd2726e0
...
...
@@ -350,15 +350,14 @@ int check_entity(const ir_entity *entity)
return
fine
;
}
static
void
check_tore
(
type
_or_ent
tore
,
void
*
env
)
static
void
check_tore
(
ir_
type
*
const
type
,
ir_entity
*
const
entity
,
void
*
const
env
)
{
bool
*
fine
=
(
bool
*
)
env
;
if
(
is_
type
(
tore
.
typ
)
)
{
*
fine
&=
check_type
(
tore
.
typ
);
if
(
type
)
{
*
fine
&=
check_type
(
typ
e
);
}
else
{
assert
(
is_entity
(
tore
.
ent
));
*
fine
&=
check_entity
(
tore
.
ent
);
*
fine
&=
check_entity
(
entity
);
}
}
...
...
ir/tr/type_finalization.c
View file @
cd2726e0
...
...
@@ -17,12 +17,11 @@
DEBUG_ONLY
(
static
firm_dbg_module_t
*
dbg
;)
static
void
do_finalization
(
type
_or_ent
tore
,
void
*
env
)
static
void
do_finalization
(
ir_
type
*
const
cls
,
ir_entity
*
const
ent
,
void
*
const
env
)
{
ir_type
*
glob_tp
=
(
ir_type
*
)
env
;
if
(
is_type
(
tore
.
typ
))
{
ir_type
*
cls
=
tore
.
typ
;
if
(
cls
)
{
if
(
!
is_Class_type
(
cls
))
return
;
...
...
@@ -36,7 +35,6 @@ static void do_finalization(type_or_ent tore, void *env)
get_class_name
(
cls
)));
}
}
else
{
ir_entity
*
ent
=
tore
.
ent
;
if
(
is_entity_final
(
ent
))
return
;
...
...
ir/tr/typewalk.c
View file @
cd2726e0
...
...
@@ -68,52 +68,39 @@ static void walk_initializer(ir_initializer_t *initializer,
* Main walker: walks over all used types/entities of a
* type entity.
*/
static
void
do_type_walk
(
type
_or_ent
tore
,
static
void
do_type_walk
(
ir_
type
*
const
tp
,
ir_entity
*
const
ent
,
type_walk_func
*
pre
,
type_walk_func
*
post
,
void
*
env
)
{
const
firm_kind
kind
=
get_kind
(
tore
.
ent
);
/* marked? */
ir_entity
*
ent
=
NULL
;
ir_type
*
tp
=
NULL
;
switch
(
kind
)
{
case
k_entity
:
ent
=
tore
.
ent
;
if
(
ent
)
{
if
(
entity_visited
(
ent
))
return
;
mark_entity_visited
(
ent
);
break
;
case
k_type
:
tp
=
tore
.
typ
;
}
else
{
if
(
type_visited
(
tp
))
return
;
mark_type_visited
(
tp
);
break
;
default:
break
;
}
/* execute pre method */
if
(
pre
)
pre
(
t
ore
,
env
);
pre
(
t
p
,
ent
,
env
);
/* iterate */
type_or_ent
cont
;
switch
(
kind
)
{
case
k_entity
:
cont
.
typ
=
get_entity_owner
(
ent
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
cont
.
typ
=
get_entity_type
(
ent
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
if
(
ent
)
{
do_type_walk
(
get_entity_owner
(
ent
),
NULL
,
pre
,
post
,
env
);
do_type_walk
(
get_entity_type
(
ent
),
NULL
,
pre
,
post
,
env
);
switch
(
get_entity_kind
(
ent
))
{
case
IR_ENTITY_ALIAS
:
cont
.
ent
=
get_entity_alias
(
ent
);
if
(
cont
.
ent
!=
NULL
)
do_type_walk
(
cont
,
pre
,
post
,
env
);
case
IR_ENTITY_ALIAS
:
{
ir_entity
*
const
e
=
get_entity_alias
(
ent
);
if
(
e
)
do_type_walk
(
NULL
,
e
,
pre
,
post
,
env
);
break
;
}
case
IR_ENTITY_METHOD
:
case
IR_ENTITY_NORMAL
:
/* walk over the value types */
...
...
@@ -128,65 +115,54 @@ static void do_type_walk(type_or_ent tore,
case
IR_ENTITY_GOTENTRY
:
break
;
}
break
;
case
k_type
:
}
else
{
switch
(
get_type_tpop_code
(
tp
))
{
case
tpo_class
:
for
(
size_t
i
=
0
,
n_types
=
get_class_n_supertypes
(
tp
);
i
<
n_types
;
++
i
)
{
cont
.
typ
=
get_class_supertype
(
tp
,
i
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
get_class_supertype
(
tp
,
i
),
NULL
,
pre
,
post
,
env
);
}
for
(
size_t
i
=
0
,
n_mem
=
get_class_n_members
(
tp
);
i
<
n_mem
;
++
i
)
{
cont
.
ent
=
get_class_member
(
tp
,
i
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
NULL
,
get_class_member
(
tp
,
i
),
pre
,
post
,
env
);
}
for
(
size_t
i
=
0
,
n_types
=
get_class_n_subtypes
(
tp
);
i
<
n_types
;
++
i
)
{
cont
.
typ
=
get_class_subtype
(
tp
,
i
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
get_class_subtype
(
tp
,
i
),
NULL
,
pre
,
post
,
env
);
}
break
;
case
tpo_struct
:
for
(
size_t
i
=
0
,
n_mem
=
get_struct_n_members
(
tp
);
i
<
n_mem
;
++
i
)
{
cont
.
ent
=
get_struct_member
(
tp
,
i
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
NULL
,
get_struct_member
(
tp
,
i
),
pre
,
post
,
env
);
}
break
;
case
tpo_method
:
for
(
size_t
i
=
0
,
n_params
=
get_method_n_params
(
tp
);
i
<
n_params
;
++
i
)
{
cont
.
typ
=
get_method_param_type
(
tp
,
i
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
get_method_param_type
(
tp
,
i
),
NULL
,
pre
,
post
,
env
);
}
for
(
size_t
i
=
0
,
n_res
=
get_method_n_ress
(
tp
);
i
<
n_res
;
++
i
)
{
cont
.
typ
=
get_method_res_type
(
tp
,
i
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
get_method_res_type
(
tp
,
i
),
NULL
,
pre
,
post
,
env
);
}
break
;
case
tpo_union
:
for
(
size_t
i
=
0
,
n_members
=
get_union_n_members
(
tp
);
i
<
n_members
;
++
i
)
{
cont
.
ent
=
get_union_member
(
tp
,
i
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
NULL
,
get_union_member
(
tp
,
i
),
pre
,
post
,
env
);
}
break
;
case
tpo_array
:
cont
.
typ
=
get_array_element_type
(
tp
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
cont
.
ent
=
get_array_element_entity
(
tp
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
get_array_element_type
(
tp
),
NULL
,
pre
,
post
,
env
);
do_type_walk
(
NULL
,
get_array_element_entity
(
tp
),
pre
,
post
,
env
);
break
;
case
tpo_pointer
:
cont
.
typ
=
get_pointer_points_to_type
(
tp
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
get_pointer_points_to_type
(
tp
),
NULL
,
pre
,
post
,
env
);
break
;
case
tpo_code
:
...
...
@@ -197,16 +173,11 @@ static void do_type_walk(type_or_ent tore,
case
tpo_uninitialized
:
panic
(
"Faulty type"
);
}
break
;
/* end case k_type */
default:
printf
(
" *** Faulty type or entity!
\n
"
);
break
;
}
/* execute post method */
if
(
post
)
post
(
t
ore
,
env
);
post
(
t
p
,
ent
,
env
);
}
/** Check whether node contains types or entities as an attribute.
...
...
@@ -214,13 +185,12 @@ static void do_type_walk(type_or_ent tore,
static
void
irn_type_walker
(
ir_node
*
node
,
type_walk_func
*
pre
,
type_walk_func
*
post
,
void
*
env
)
{
type_or_ent
cont
;
cont
.
ent
=
get_irn_entity_attr
(
node
);
if
(
cont
.
ent
)
do_type_walk
(
cont
,
pre
,
post
,
env
);
cont
.
typ
=
get_irn_type_attr
(
node
);
if
(
cont
.
typ
)
do_type_walk
(
cont
,
pre
,
post
,
env
);
ir_entity
*
const
ent
=
get_irn_entity_attr
(
node
);
if
(
ent
)
do_type_walk
(
NULL
,
ent
,
pre
,
post
,
env
);
ir_type
*
const
typ
=
get_irn_type_attr
(
node
);
if
(
typ
)
do_type_walk
(
typ
,
NULL
,
pre
,
post
,
env
);
}
/** Check whether node contains types or entities as an attribute.
...
...
@@ -238,13 +208,10 @@ void type_walk(type_walk_func *pre, type_walk_func *post, void *env)
{
irp_reserve_resources
(
irp
,
IRP_RESOURCE_TYPE_VISITED
);
inc_master_type_visited
();
type_or_ent
cont
;
for
(
size_t
i
=
0
,
n_types
=
get_irp_n_types
();
i
<
n_types
;
++
i
)
{
cont
.
typ
=
get_irp_type
(
i
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
get_irp_type
(
i
),
NULL
,
pre
,
post
,
env
);
}
cont
.
typ
=
get_glob_type
();
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
get_glob_type
(),
NULL
,
pre
,
post
,
env
);
irp_free_resources
(
irp
,
IRP_RESOURCE_TYPE_VISITED
);
}
...
...
@@ -276,79 +243,52 @@ void type_walk_irg(ir_graph *irg,
inc_master_type_visited
();
irg_walk
(
get_irg_end
(
irg
),
start_type_walk
,
NULL
,
&
type_env
);
type_or_ent
cont
;
cont
.
ent
=
get_irg_entity
(
irg
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
NULL
,
get_irg_entity
(
irg
),
pre
,
post
,
env
);
cont
.
typ
=
get_irg_frame_type
(
irg
);
do_type_walk
(
cont
,
pre
,
post
,
env
);
do_type_walk
(
get_irg_frame_type
(
irg
),
NULL
,
pre
,
post
,
env
);
irp_free_resources
(
irp
,
IRP_RESOURCE_TYPE_VISITED
);
current_ir_graph
=
rem
;
}
static
void
type_walk_s2s_2
(
type
_or_ent
tore
,
static
void
type_walk_s2s_2
(
ir_
type
*
const
tp
,
type_walk_func
*
pre
,
type_walk_func
*
post
,
void
*
env
)
{
/* marked? */
switch
(
get_kind
(
tore
.
ent
))
{
case
k_entity
:
if
(
entity_visited
(
tore
.
ent
))
return
;
break
;
case
k_type
:
if
(
type_visited
(
tore
.
typ
))
return
;
break
;
default:
break
;
}
if
(
type_visited
(
tp
))
return
;
/* iterate */
type_or_ent
cont
;
switch
(
get_kind
(
tore
.
typ
))
{
case
k_type
:
{
ir_type
*
tp
=
tore
.
typ
;
mark_type_visited
(
tp
);
switch
(
get_type_tpop_code
(
tp
))
{
case
tpo_class
:
{
for
(
size_t
i
=
0
,
n
=
get_class_n_supertypes
(
tp
);
i
<
n
;
++
i
)
{
cont
.
typ
=
get_class_supertype
(
tp
,
i
);
type_walk_s2s_2
(
cont
,
pre
,
post
,
env
);
}
/* execute pre method */
if
(
pre
)
pre
(
tore
,
env
);
for
(
size_t
i
=
0
,
n
=
get_class_n_subtypes
(
tp
);
i
<
n
;
++
i
)
{
cont
.
typ
=
get_class_subtype
(
tp
,
i
);
type_walk_s2s_2
(
cont
,
pre
,
post
,
env
);
}
/* execute post method */
if
(
post
)
post
(
tore
,
env
);
break
;
}
case
tpo_struct
:
case
tpo_method
:
case
tpo_union
:
case
tpo_array
:
case
tpo_pointer
:
case
tpo_primitive
:
/* dont care */
break
;
default:
printf
(
" *** Faulty type!
\n
"
);
break
;
}
}
break
;
/* end case k_type */
case
k_entity
:
/* don't care */
mark_type_visited
(
tp
);
switch
(
get_type_tpop_code
(
tp
))
{
case
tpo_class
:
{
for
(
size_t
i
=
0
,
n
=
get_class_n_supertypes
(
tp
);
i
<
n
;
++
i
)
{
type_walk_s2s_2
(
get_class_supertype
(
tp
,
i
),
pre
,
post
,
env
);
}
/* execute pre method */
if
(
pre
)
pre
(
tp
,
NULL
,
env
);
for
(
size_t
i
=
0
,
n
=
get_class_n_subtypes
(
tp
);
i
<
n
;
++
i
)
{
type_walk_s2s_2
(
get_class_subtype
(
tp
,
i
),
pre
,
post
,
env
);
}
/* execute post method */
if
(
post
)
post
(
tp
,
NULL
,
env
);
break
;
}
case
tpo_struct
:
case
tpo_method
:
case
tpo_union
:
case
tpo_array
:
case
tpo_pointer
:
case
tpo_primitive
:
/* dont care */
break
;
default:
printf
(
" *** Faulty type
or entity
!
\n
"
);
printf
(
" *** Faulty type!
\n
"
);
break
;
}
}
...
...
@@ -359,75 +299,47 @@ void type_walk_super2sub(type_walk_func *pre,
{
irp_reserve_resources
(
irp
,
IRP_RESOURCE_TYPE_VISITED
);
inc_master_type_visited
();
type_or_ent
cont
;
cont
.
typ
=
get_glob_type
();
type_walk_s2s_2
(
cont
,
pre
,
post
,
env
);
type_walk_s2s_2
(
get_glob_type
(),
pre
,
post
,
env
);
for
(
size_t
i
=
0
,
n_types
=
get_irp_n_types
();
i
<
n_types
;
++
i
)
{
cont
.
typ
=
get_irp_type
(
i
);
type_walk_s2s_2
(
cont
,
pre
,
post
,
env
);
type_walk_s2s_2
(
get_irp_type
(
i
),
pre
,
post
,
env
);
}
irp_free_resources
(
irp
,
IRP_RESOURCE_TYPE_VISITED
);
}
/*****************************************************************************/
static
void
type_walk_super_2
(
type
_or_ent
tore
,
type_walk_func
*
pre
,
static
void
type_walk_super_2
(
ir_
type
*
const
tp
,
type_walk_func
*
pre
,
type_walk_func
*
post
,
void
*
env
)
{
/* marked? */
switch
(
get_kind
(
tore
.
ent
))
{
case
k_entity
:
if
(
entity_visited
(
tore
.
ent
))
return
;
break
;
case
k_type
:
if
(
type_visited
(
tore
.
typ
))
return
;
break
;
default:
break
;
}
if
(
type_visited
(
tp
))
return
;
/* iterate */
type_or_ent
cont
;
switch
(
get_kind
(
tore
.
typ
))
{
case
k_type
:
{
ir_type
*
tp
=
tore
.
typ
;
mark_type_visited
(
tp
);
switch
(
get_type_tpop_code
(
tp
))
{