diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-03-31 17:37:03 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-03-31 17:37:03 +0200 |
commit | 290d8971e6e3b784a88b5c4b6b91b8d77552cb3a (patch) | |
tree | d92c2f3ed1dfcbb58f769df2fba83d1db975f4bd /gcc | |
parent | 109f4af30fe82f245ee1acdebc656d3f185eeebb (diff) | |
download | gcc-290d8971e6e3b784a88b5c4b6b91b8d77552cb3a.zip gcc-290d8971e6e3b784a88b5c4b6b91b8d77552cb3a.tar.gz gcc-290d8971e6e3b784a88b5c4b6b91b8d77552cb3a.tar.bz2 |
dwarf2out.c (size_of_die): For -gdwarf-4 use uleb128 size instead of fixed 1 or 2 for dw_val_class_loc and...
* dwarf2out.c (size_of_die): For -gdwarf-4 use
uleb128 size instead of fixed 1 or 2 for dw_val_class_loc
and 0 instead of 1 for dw_val_class_flag.
(value_format): For -gdwarf-4 use DW_FORM_sec_offset for
dw_val_class_range_list, dw_val_class_loc_list,
dw_val_class_lineptr and dw_val_class_macptr, use
DW_FORM_flag_present for dw_val_class_flag and
DW_FORM_exprloc for dw_val_class_loc.
(output_die): For -gdwarf-4 print dw_val_class_loc
size as uleb128 instead of 1 or 2 bytes and don't print
anything for dw_val_class_flag.
From-SVN: r157871
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 55 |
2 files changed, 62 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b06bb6..d14790c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,17 @@ 2010-03-31 Jakub Jelinek <jakub@redhat.com> + * dwarf2out.c (size_of_die): For -gdwarf-4 use + uleb128 size instead of fixed 1 or 2 for dw_val_class_loc + and 0 instead of 1 for dw_val_class_flag. + (value_format): For -gdwarf-4 use DW_FORM_sec_offset for + dw_val_class_range_list, dw_val_class_loc_list, + dw_val_class_lineptr and dw_val_class_macptr, use + DW_FORM_flag_present for dw_val_class_flag and + DW_FORM_exprloc for dw_val_class_loc. + (output_die): For -gdwarf-4 print dw_val_class_loc + size as uleb128 instead of 1 or 2 bytes and don't print + anything for dw_val_class_flag. + * var-tracking.c (vt_init_cfa_base): Use cselib_lookup_from_insn instead of cselib_lookup following by tweaking locs->setting_insn. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 84a5fe7..86ae89b 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9920,7 +9920,10 @@ size_of_die (dw_die_ref die) unsigned long lsize = size_of_locs (AT_loc (a)); /* Block length. */ - size += constant_size (lsize); + if (dwarf_version >= 4) + size += size_of_uleb128 (lsize); + else + size += constant_size (lsize); size += lsize; } break; @@ -9948,7 +9951,16 @@ size_of_die (dw_die_ref die) * a->dw_attr_val.v.val_vec.elt_size; /* block */ break; case dw_val_class_flag: - size += 1; + if (dwarf_version >= 4) + /* Currently all add_AT_flag calls pass in 1 as last argument, + so DW_FORM_flag_present can be used. If that ever changes, + we'll need to use DW_FORM_flag and have some optimization + in build_abbrev_table that will change those to + DW_FORM_flag_present if it is set to 1 in all DIEs using + the same abbrev entry. */ + gcc_assert (a->dw_attr_val.v.val_flag == 1); + else + size += 1; break; case dw_val_class_die_ref: if (AT_ref_external (a)) @@ -10142,8 +10154,11 @@ value_format (dw_attr_ref a) gcc_unreachable (); } case dw_val_class_range_list: - case dw_val_class_offset: case dw_val_class_loc_list: + if (dwarf_version >= 4) + return DW_FORM_sec_offset; + /* FALLTHRU */ + case dw_val_class_offset: switch (DWARF_OFFSET_SIZE) { case 4: @@ -10154,6 +10169,8 @@ value_format (dw_attr_ref a) gcc_unreachable (); } case dw_val_class_loc: + if (dwarf_version >= 4) + return DW_FORM_exprloc; switch (constant_size (size_of_locs (AT_loc (a)))) { case 1: @@ -10206,6 +10223,17 @@ value_format (dw_attr_ref a) gcc_unreachable (); } case dw_val_class_flag: + if (dwarf_version >= 4) + { + /* Currently all add_AT_flag calls pass in 1 as last argument, + so DW_FORM_flag_present can be used. If that ever changes, + we'll need to use DW_FORM_flag and have some optimization + in build_abbrev_table that will change those to + DW_FORM_flag_present if it is set to 1 in all DIEs using + the same abbrev entry. */ + gcc_assert (a->dw_attr_val.v.val_flag == 1); + return DW_FORM_flag_present; + } return DW_FORM_flag; case dw_val_class_die_ref: if (AT_ref_external (a)) @@ -10218,7 +10246,7 @@ value_format (dw_attr_ref a) return DW_FORM_addr; case dw_val_class_lineptr: case dw_val_class_macptr: - return DW_FORM_data; + return dwarf_version >= 4 ? DW_FORM_sec_offset : DW_FORM_data; case dw_val_class_str: return AT_string_form (a); case dw_val_class_file: @@ -10450,7 +10478,10 @@ output_die (dw_die_ref die) size = size_of_locs (AT_loc (a)); /* Output the block length for this list of location operations. */ - dw2_asm_output_data (constant_size (size), size, "%s", name); + if (dwarf_version >= 4) + dw2_asm_output_data_uleb128 (size, "%s", name); + else + dw2_asm_output_data (constant_size (size), size, "%s", name); output_loc_sequence (AT_loc (a)); break; @@ -10518,6 +10549,20 @@ output_die (dw_die_ref die) } case dw_val_class_flag: + if (dwarf_version >= 4) + { + /* Currently all add_AT_flag calls pass in 1 as last argument, + so DW_FORM_flag_present can be used. If that ever changes, + we'll need to use DW_FORM_flag and have some optimization + in build_abbrev_table that will change those to + DW_FORM_flag_present if it is set to 1 in all DIEs using + the same abbrev entry. */ + gcc_assert (AT_flag (a) == 1); + if (flag_debug_asm) + fprintf (asm_out_file, "\t\t\t%s %s\n", + ASM_COMMENT_START, name); + break; + } dw2_asm_output_data (1, AT_flag (a), "%s", name); break; |