diff options
| author | Petr Machata <[email protected]> | 2014-06-20 22:59:43 +0200 |
|---|---|---|
| committer | Petr Machata <[email protected]> | 2014-06-20 22:59:43 +0200 |
| commit | ba9e5156207e3c2bb85adc747376e774af3c0df6 (patch) | |
| tree | 844f001f0e11201c301fb52a6561c0d7a5402bdd /backends/ppc_retval.c | |
| parent | 41362da47b7c570738c3fba55dae6fb42dd63b85 (diff) | |
backends (*_return_value_location): call dwarf_peeled_die_type
... instead of inlining equivalent code.
Signed-off-by: Petr Machata <[email protected]>
Diffstat (limited to 'backends/ppc_retval.c')
| -rw-r--r-- | backends/ppc_retval.c | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/backends/ppc_retval.c b/backends/ppc_retval.c index 7ca0c185..b14a99f1 100644 --- a/backends/ppc_retval.c +++ b/backends/ppc_retval.c @@ -1,5 +1,5 @@ /* Function return value location for Linux/PPC ABI. - Copyright (C) 2005, 2006, 2007, 2010 Red Hat, Inc. + Copyright (C) 2005, 2006, 2007, 2010, 2014 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -89,27 +89,10 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) { /* Start with the function's type, and get the DW_AT_type attribute, which is the type of the return value. */ - - Dwarf_Attribute attr_mem; - Dwarf_Attribute *attr = dwarf_attr_integrate (functypedie, DW_AT_type, - &attr_mem); - if (attr == NULL) - /* The function has no return value, like a `void' function in C. */ - return 0; - - Dwarf_Die die_mem; - Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem); - int tag = DWARF_TAG_OR_RETURN (typedie); - - /* Follow typedefs and qualifiers to get to the actual type. */ - while (tag == DW_TAG_typedef - || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type - || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type) - { - attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); - typedie = dwarf_formref_die (attr, &die_mem); - tag = DWARF_TAG_OR_RETURN (typedie); - } + Dwarf_Die die_mem, *typedie = &die_mem; + int tag = dwarf_peeled_die_type (functypedie, typedie); + if (tag <= 0) + return tag; Dwarf_Word size; switch (tag) @@ -120,6 +103,7 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_subrange_type: if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size)) { + Dwarf_Attribute attr_mem, *attr; attr = dwarf_attr_integrate (typedie, DW_AT_type, &attr_mem); typedie = dwarf_formref_die (attr, &die_mem); tag = DWARF_TAG_OR_RETURN (typedie); @@ -130,18 +114,23 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_enumeration_type: case DW_TAG_pointer_type: case DW_TAG_ptr_to_member_type: - if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, - &attr_mem), &size) != 0) - { - if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) - size = 4; - else - return -1; - } + { + Dwarf_Attribute attr_mem; + if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_byte_size, + &attr_mem), &size) != 0) + { + if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type) + size = 4; + else + return -1; + } + } + if (size <= 8) { if (tag == DW_TAG_base_type) { + Dwarf_Attribute attr_mem; Dwarf_Word encoding; if (dwarf_formudata (dwarf_attr_integrate (typedie, DW_AT_encoding, @@ -165,6 +154,7 @@ ppc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp) case DW_TAG_array_type: { + Dwarf_Attribute attr_mem; bool is_vector; if (dwarf_formflag (dwarf_attr_integrate (typedie, DW_AT_GNU_vector, &attr_mem), &is_vector) == 0 |
