X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbestabs.c;h=a636a27e63221fb834097b40a707c15d29b27970;hb=89dc24503c04139bb05504059b291d6d89f99661;hp=ad44e66f0afdf5c1576856647114ddccb32bf677;hpb=b6d8cb4ac5f28bd50cb804f02df94712321ba246;p=libfirm diff --git a/ir/be/bestabs.c b/ir/be/bestabs.c index ad44e66f0..a636a27e6 100644 --- a/ir/be/bestabs.c +++ b/ir/be/bestabs.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -207,7 +207,7 @@ static void gen_primitive_type(stabs_handle *h, ir_type *tp) { type_num = get_type_number(h, tp); - if (mode_is_int(mode) || mode_is_character(mode)) { + if (mode_is_int(mode)) { char buf[64]; fprintf(h->f, "\t.stabs\t\"%s:t%u=r%u;", get_type_name(tp), type_num, type_num); tarval_snprintf(buf, sizeof(buf), get_mode_min(mode)); @@ -245,8 +245,7 @@ static void gen_enum_type(stabs_handle *h, ir_type *tp) { /** * print a pointer type */ -void print_pointer_type(wenv_t *env, ir_type *tp, int local) { - stabs_handle *h = env->h; +void print_pointer_type(stabs_handle *h, ir_type *tp, int local) { unsigned type_num = local ? h->next_type_nr++ : get_type_number(h, tp); ir_type *el_tp = get_pointer_points_to_type(tp); unsigned el_num = get_type_number(h, el_tp); @@ -269,15 +268,14 @@ static void gen_pointer_type(wenv_t *env, ir_type *tp) { waitq_put(env->wq, el_tp); fprintf(h->f, "\t.stabs\t\"%s:t", get_type_name(tp)); - print_pointer_type(env, tp, 0); + print_pointer_type(h, tp, 0); fprintf(h->f, "\",%d,0,0,0\n", N_LSYM); } /* gen_pointer_type */ /** * print an array type */ -static void print_array_type(wenv_t *env, ir_type *tp, int local) { - stabs_handle *h = env->h; +static void print_array_type(stabs_handle *h, ir_type *tp, int local) { ir_type *etp = get_array_element_type(tp); int i, n = get_array_n_dimensions(tp); unsigned type_num = local ? h->next_type_nr++ : get_type_number(h, tp); @@ -312,7 +310,7 @@ static void print_array_type(wenv_t *env, ir_type *tp, int local) { * @param tp the type */ static void gen_array_type(wenv_t *env, ir_type *tp) { - stabs_handle *h = env->h; + stabs_handle *h = env->h; ir_type *etp = get_array_element_type(tp); SET_TYPE_READY(tp); @@ -321,7 +319,7 @@ static void gen_array_type(wenv_t *env, ir_type *tp) { fprintf(h->f, "\t.stabs\t\"%s:t", get_type_name(tp)); - print_array_type(env, tp, 0); + print_array_type(h, tp, 0); fprintf(h->f, "\",%d,0,0,0\n", N_LSYM); } /* gen_array_type */ @@ -355,7 +353,8 @@ static void gen_struct_union_type(wenv_t *env, ir_type *tp) { for (i = 0, n = get_compound_n_members(tp); i < n; ++i) { ir_entity *ent = get_compound_member(tp, i); ir_type *mtp = get_entity_type(ent); - int ofs, size; + int ofs; + unsigned size; if (! IS_TYPE_READY(mtp)) waitq_put(env->wq, mtp); @@ -370,11 +369,11 @@ static void gen_struct_union_type(wenv_t *env, ir_type *tp) { int bofs; type_num = get_type_number(h, tp); - size = get_type_size_bits(tp); + size = get_type_size_bytes(tp) * 8; bofs = (ofs + get_entity_offset(ent)) * 8 + get_entity_offset_bits_remainder(ent); /* name:type, bit offset from the start of the struct', number of bits in the element. */ - fprintf(h->f, "%s:%u,%d,%d;", get_entity_name(ent), type_num, bofs, size); + fprintf(h->f, "%s:%u,%d,%u;", get_entity_name(ent), type_num, bofs, size); } } else { /* no bitfield */ @@ -382,18 +381,18 @@ static void gen_struct_union_type(wenv_t *env, ir_type *tp) { if (is_Array_type(mtp)) { /* use a local array definition */ - print_array_type(env, mtp, 1); + print_array_type(h, mtp, 1); } else if (is_Pointer_type(mtp)) { /* use local pointer definition */ - print_pointer_type(env, mtp, 1); + print_pointer_type(h, mtp, 1); } else { type_num = get_type_number(h, mtp); /* name:type, bit offset from the start of the struct', number of bits in the element. */ fprintf(h->f, "%u", type_num); } - size = get_type_size_bits(mtp); - fprintf(h->f, ",%d,%d;", ofs * 8, size); + size = get_type_size_bytes(mtp) * 8; + fprintf(h->f, ",%d,%u;", ofs * 8, size); } } fprintf(h->f, ";\",%d,0,0,0\n", N_LSYM); @@ -648,7 +647,21 @@ static void stabs_method_begin(dbg_handle *handle, ir_entity *ent, const be_stac if (stack_ent) { ofs = get_entity_offset(stack_ent) + between_size; } - fprintf(h->f, "\t.stabs\t\"%s:p%u\",%d,0,0,%d\n", name, type_num, N_PSYM, ofs); + fprintf(h->f, "\t.stabs\t\"%s:p", name); + if (is_Array_type(ptp)) { + /* use a local array definition */ + print_array_type(h, ptp, 1); + } else if (is_Pointer_type(ptp)) { + /* use local pointer definition */ + print_pointer_type(h, ptp, 1); + } else { + type_num = get_type_number(h, ptp); + + /* name:type, bit offset from the start of the struct', number of bits in the element. */ + fprintf(h->f, "%u", type_num); + } + + fprintf(h->f, "\",%d,0,0,%d\n", N_PSYM, ofs); } } /* stabs_method_begin */