X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbestabs.c;h=a385da5d4d4af51829c01c7c80253c7e0890bca5;hb=5474a1c188c9d59eea2c915515980cd9cbab58d8;hp=6253a95b05bd43344df64039e91743f5be1a3202;hpb=f8dfdaaff8e4f364da8494fd35a9bb2f8c267e7f;p=libfirm diff --git a/ir/be/bestabs.c b/ir/be/bestabs.c index 6253a95b0..a385da5d4 100644 --- a/ir/be/bestabs.c +++ b/ir/be/bestabs.c @@ -22,7 +22,6 @@ * @brief Stabs support. * @author Michael Beck * @date 11.9.2006 - * @version $Id$ */ #include "config.h" @@ -131,29 +130,29 @@ typedef struct stabs_handle { */ static unsigned get_type_number(stabs_handle *h, ir_type *tp) { - pmap_entry *entry; + void *entry; unsigned num; if (tp == NULL) { /* map to the void type */ return 0; } - entry = pmap_find(h->type_map, tp); - if (! entry) { + entry = pmap_get(h->type_map, tp); + if (entry == NULL) { num = h->next_type_nr++; - pmap_insert(h->type_map, tp, INT_TO_PTR(num)); + pmap_insert(h->type_map, tp, INT_TO_PTR(num+1)); } else { - num = (unsigned)PTR_TO_INT(entry->value); + num = ((unsigned)PTR_TO_INT(entry))-1; } return num; -} /* get_type_number */ +} /** * Map a given Type to void by assigned the type number 0. */ static void map_to_void(stabs_handle *h, ir_type *tp) { - pmap_insert(h->type_map, tp, INT_TO_PTR(0)); + pmap_insert(h->type_map, tp, INT_TO_PTR(1)); } /** @@ -164,7 +163,7 @@ static void gen_void_type(stabs_handle *h) (void) h; be_emit_irprintf("\t.stabs\t\"void:t%u=%u\",%d,0,0,0\n", 0, 0, N_LSYM); be_emit_write_line(); -} /* gen_void_type */ +} typedef struct walker_env { stabs_handle *h; @@ -242,13 +241,13 @@ static void gen_primitive_type(stabs_handle *h, ir_type *tp) Ignore it here as it's name is remapped to "void". */ map_to_void(h, tp); return; - } /* if */ + } #if 0 if (get_mode_size_bits(mode) & 7) { /* this is a bitfield type, ignore it */ return; - } /* if */ + } #endif type_num = get_type_number(h, tp); @@ -269,7 +268,7 @@ static void gen_primitive_type(stabs_handle *h, ir_type *tp) be_emit_irprintf(":t%u=r1;%d;0;\",%d,0,0,0\n", type_num, size, N_LSYM); be_emit_write_line(); } -} /* gen_primitive_type */ +} /** * Generates an enum type @@ -295,7 +294,7 @@ static void gen_enum_type(stabs_handle *h, ir_type *tp) } be_emit_irprintf(";\",%d,0,0,0\n", N_LSYM); be_emit_write_line(); -} /* gen_enum_type */ +} /** * print a pointer type @@ -330,7 +329,7 @@ static void gen_pointer_type(wenv_t *env, ir_type *tp) print_pointer_type(h, tp, 0); be_emit_irprintf("\",%d,0,0,0\n", N_LSYM); be_emit_write_line(); -} /* gen_pointer_type */ +} /** * print an array type @@ -387,7 +386,7 @@ static void gen_array_type(wenv_t *env, ir_type *tp) be_emit_irprintf("\",%d,0,0,0\n", N_LSYM); be_emit_write_line(); -} /* gen_array_type */ +} /** * Generates a struct/union type @@ -465,7 +464,7 @@ static void gen_struct_union_type(wenv_t *env, ir_type *tp) } be_emit_irprintf(";\",%d,0,0,0\n", N_LSYM); be_emit_write_line(); -} /* gen_struct_type */ +} /** * Generates a method type @@ -503,7 +502,7 @@ static void gen_method_type(wenv_t *env, ir_type *tp) } be_emit_irprintf("\",%d,0,0,0\n", N_LSYM); be_emit_write_line(); -} /* gen_method_type */ +} /** * type-walker: generate declaration for simple types, @@ -518,52 +517,54 @@ static void walk_type(type_or_ent tore, void *ctx) tp = tore.typ; /* ignore the unknown type */ - if (tp == firm_unknown_type) + if (is_unknown_type(tp)) return; } else { return; - } /* if */ + } switch (get_type_tpop_code(tp)) { case tpo_class: if (tp == get_glob_type()) { SET_TYPE_READY(tp); - break; + return; } /* fall through */ case tpo_struct: case tpo_union: gen_struct_union_type(env, tp); - break; + return; case tpo_enumeration: gen_enum_type(env->h, tp); - break; + return; case tpo_primitive: gen_primitive_type(env->h, tp); - break; + return; case tpo_method: gen_method_type(env, tp); - break; + return; case tpo_array: gen_array_type(env, tp); - break; + return; case tpo_pointer: gen_pointer_type(env, tp); - break; + return; + case tpo_code: + case tpo_none: case tpo_unknown: + case tpo_uninitialized: /* the unknown type: ignore */ SET_TYPE_READY(tp); - break; - default: - assert(! "Unknown tpop code"); - } /* switch */ -} /* walk_type */ + return; + } + panic("Unknown tpop code"); +} /** * generate declaration for all types @@ -604,9 +605,9 @@ static void finish_types(wenv_t *env) break; default: assert(! "Unknown tpop code"); - } /* switch */ - } /* while */ -} /* finish_types */ + } + } +} /** * generate all types. @@ -625,7 +626,7 @@ static void gen_types(stabs_handle *h) finish_types(&env); del_waitq(env.wq); -} /* gen_types */ +} /* -------------------------- I/F ----------------------------- */ @@ -758,7 +759,7 @@ static void stabs_method_begin(dbg_handle *handle, const ir_entity *ent) be_emit_irprintf("\",%d,0,0,%d\n", N_PSYM, ofs); be_emit_write_line(); } -} /* stabs_method_begin */ +} /** * dump the stabs for a method end @@ -806,7 +807,7 @@ static void stabs_method_end(dbg_handle *handle) h->cur_ent = NULL; h->layout = NULL; -} /* stabs_method_end */ +} /** * dump types @@ -819,7 +820,7 @@ static void stabs_types(dbg_handle *handle) h->next_type_nr++; gen_void_type(h); gen_types(h); -} /* stabs_types */ +} /** * dump a variable in the global type @@ -847,7 +848,7 @@ static void stabs_variable(dbg_handle *handle, const ir_entity *ent) buf[sizeof(buf) - 1] = '\0'; be_emit_string(buf); -} /* stabs_variable */ +} /** * Close the stabs handler. @@ -857,7 +858,7 @@ static void stabs_close(dbg_handle *handle) stabs_handle *h = (stabs_handle *)handle; pmap_destroy(h->type_map); free(h); -} /* stabs_close */ +} /** The stabs operations. */ static const debug_ops stabs_ops = {