Commit 3ddfc6a4 authored by Matthias Braun's avatar Matthias Braun
Browse files

type list fixes

Make sure all types are in the global type list, remove type_walk_prog
which was a strange alternative to type_walk attempting to not miss
types not in the global list.
parent f85fa8d0
...@@ -185,13 +185,6 @@ FIRM_API ir_type *get_glob_type(void); ...@@ -185,13 +185,6 @@ FIRM_API ir_type *get_glob_type(void);
*/ */
FIRM_API ir_type *get_tls_type(void); FIRM_API ir_type *get_tls_type(void);
/** Adds type to the list of types in irp. */
FIRM_API void add_irp_type(ir_type *typ);
/** Removes type from the list of types, deallocates it and
shrinks the list by one. */
FIRM_API void remove_irp_type(ir_type *typ);
/** /**
* Returns the number of all types in the irp. * Returns the number of all types in the irp.
* @deprecated * @deprecated
......
...@@ -2142,11 +2142,6 @@ typedef void class_walk_func(ir_type *clss, void *env); ...@@ -2142,11 +2142,6 @@ typedef void class_walk_func(ir_type *clss, void *env);
* Does not touch frame types or types for value params ... */ * Does not touch frame types or types for value params ... */
FIRM_API void type_walk(type_walk_func *pre, type_walk_func *post, void *env); FIRM_API void type_walk(type_walk_func *pre, type_walk_func *post, void *env);
/** Touches every type, entity, frame type, and value param type in
* unspecified order (also all segment types). */
FIRM_API void type_walk_prog(type_walk_func *pre, type_walk_func *post,
void *env);
/** Walks over all type information reachable from an ir graph. /** Walks over all type information reachable from an ir graph.
* *
* Walks over all type information reachable from irg, i.e., starts a * Walks over all type information reachable from irg, i.e., starts a
......
...@@ -368,8 +368,6 @@ static be_main_env_t *be_init_env(be_main_env_t *env, FILE *file_handle, ...@@ -368,8 +368,6 @@ static be_main_env_t *be_init_env(be_main_env_t *env, FILE *file_handle,
env->pic_symbols_type = new_type_struct(NEW_ID("$PIC_SYMBOLS_TYPE")); env->pic_symbols_type = new_type_struct(NEW_ID("$PIC_SYMBOLS_TYPE"));
env->cup_name = compilation_unit_name; env->cup_name = compilation_unit_name;
remove_irp_type(env->pic_trampolines_type);
remove_irp_type(env->pic_symbols_type);
set_class_final(env->pic_trampolines_type, 1); set_class_final(env->pic_trampolines_type, 1);
memset(asm_constraint_flags, 0, sizeof(asm_constraint_flags)); memset(asm_constraint_flags, 0, sizeof(asm_constraint_flags));
......
...@@ -79,8 +79,6 @@ static ir_prog *new_incomplete_ir_prog(void) ...@@ -79,8 +79,6 @@ static ir_prog *new_incomplete_ir_prog(void)
*/ */
static ir_prog *complete_ir_prog(ir_prog *irp, const char *module_name) static ir_prog *complete_ir_prog(ir_prog *irp, const char *module_name)
{ {
ir_segment_t s;
#define IDENT(x) new_id_from_chars(x, sizeof(x) - 1) #define IDENT(x) new_id_from_chars(x, sizeof(x) - 1)
irp->name = new_id_from_str(module_name); irp->name = new_id_from_str(module_name);
...@@ -92,11 +90,6 @@ static ir_prog *complete_ir_prog(ir_prog *irp, const char *module_name) ...@@ -92,11 +90,6 @@ static ir_prog *complete_ir_prog(ir_prog *irp, const char *module_name)
= new_type_class(IDENT("Constructors")); = new_type_class(IDENT("Constructors"));
irp->segment_types[IR_SEGMENT_DESTRUCTORS] irp->segment_types[IR_SEGMENT_DESTRUCTORS]
= new_type_class(IDENT("Destructors")); = new_type_class(IDENT("Destructors"));
/* Remove these types from type list. Must be treated differently than
other types. */
for (s = IR_SEGMENT_FIRST; s <= IR_SEGMENT_LAST; ++s) {
remove_irp_type(irp->segment_types[s]);
}
/* Set these flags for debugging. */ /* Set these flags for debugging. */
irp->segment_types[IR_SEGMENT_GLOBAL]->flags |= tf_global_type; irp->segment_types[IR_SEGMENT_GLOBAL]->flags |= tf_global_type;
...@@ -186,8 +179,6 @@ void set_segment_type(ir_segment_t segment, ir_type *new_type) ...@@ -186,8 +179,6 @@ void set_segment_type(ir_segment_t segment, ir_type *new_type)
{ {
assert(segment <= IR_SEGMENT_LAST); assert(segment <= IR_SEGMENT_LAST);
irp->segment_types[segment] = new_type; irp->segment_types[segment] = new_type;
/* segment types are not in the type list... */
remove_irp_type(new_type);
} }
ir_type *(get_glob_type)(void) ir_type *(get_glob_type)(void)
......
...@@ -160,6 +160,13 @@ void init_irprog_1(void); ...@@ -160,6 +160,13 @@ void init_irprog_1(void);
/** Completes ir_prog. */ /** Completes ir_prog. */
void init_irprog_2(void); void init_irprog_2(void);
/** Adds type to the list of types in irp. */
FIRM_API void add_irp_type(ir_type *typ);
/** Removes type from the list of types, deallocates it and
shrinks the list by one. */
FIRM_API void remove_irp_type(ir_type *typ);
/* Inline functions. */ /* Inline functions. */
#define get_irp_n_irgs() get_irp_n_irgs_() #define get_irp_n_irgs() get_irp_n_irgs_()
#define get_irp_irg(pos) get_irp_irg_(pos) #define get_irp_irg(pos) get_irp_irg_(pos)
......
...@@ -86,16 +86,13 @@ void ir_init_type(void) ...@@ -86,16 +86,13 @@ void ir_init_type(void)
firm_none_type = new_type(tpop_none, mode_BAD, NULL); firm_none_type = new_type(tpop_none, mode_BAD, NULL);
set_type_size_bytes(firm_none_type, 0); set_type_size_bytes(firm_none_type, 0);
set_type_state (firm_none_type, layout_fixed); set_type_state (firm_none_type, layout_fixed);
remove_irp_type(firm_none_type);
firm_code_type = new_type(tpop_code, mode_ANY, NULL); firm_code_type = new_type(tpop_code, mode_ANY, NULL);
set_type_state(firm_code_type, layout_fixed); set_type_state(firm_code_type, layout_fixed);
remove_irp_type(firm_code_type);
firm_unknown_type = new_type(tpop_unknown, mode_ANY, NULL); firm_unknown_type = new_type(tpop_unknown, mode_ANY, NULL);
set_type_size_bytes(firm_unknown_type, 0); set_type_size_bytes(firm_unknown_type, 0);
set_type_state (firm_unknown_type, layout_fixed); set_type_state (firm_unknown_type, layout_fixed);
remove_irp_type(firm_unknown_type);
} }
void ir_finish_type(void) void ir_finish_type(void)
...@@ -1960,9 +1957,6 @@ ir_type *new_type_frame(void) ...@@ -1960,9 +1957,6 @@ ir_type *new_type_frame(void)
res->flags |= tf_frame_type; res->flags |= tf_frame_type;
/* Remove type from type list. Must be treated differently than other types. */
remove_irp_type(res);
/* It is not possible to derive from the frame type. Set the final flag. */ /* It is not possible to derive from the frame type. Set the final flag. */
set_class_final(res, 1); set_class_final(res, 1);
......
...@@ -273,26 +273,6 @@ void type_walk(type_walk_func *pre, type_walk_func *post, void *env) ...@@ -273,26 +273,6 @@ void type_walk(type_walk_func *pre, type_walk_func *post, void *env)
irp_free_resources(irp, IRP_RESOURCE_TYPE_VISITED); irp_free_resources(irp, IRP_RESOURCE_TYPE_VISITED);
} }
void type_walk_prog(type_walk_func *pre, type_walk_func *post, void *env)
{
size_t i, n_irgs = get_irp_n_irgs();
type_or_ent cont;
type_walk(pre, post, env);
for (i = 0; i < n_irgs; ++i) {
ir_graph *irg = get_irp_irg(i);
cont.typ = get_irg_frame_type(irg);
do_type_walk(cont, pre, post, env);
}
for (i = IR_SEGMENT_FIRST; i <= IR_SEGMENT_LAST; ++i) {
cont.typ = get_segment_type((ir_segment_t) i);
if (cont.typ)
do_type_walk(cont, pre, post, env);
}
}
void type_walk_irg(ir_graph *irg, void type_walk_irg(ir_graph *irg,
type_walk_func *pre, type_walk_func *pre,
type_walk_func *post, type_walk_func *post,
......
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