Commit b1ccbc24 by Richard Kenner

Cast first arg in all calls to bzero to char *.

(decl_ultimate_origin): Return NULL if equal to decl.
(constant_size): Never return more than 4.
(value_format, case 8): New case.
(dwarf2out_frame_debug): Use HARD_FRAME_POINTER_REGNUM.
(based_loc_descr): Likewise.
(add_bound_info): Delete default case.
Add cases for CONVERT_EXPR and NON_LVALUE_EXPR; treat like NOP_EXPR.
Change NOP_EXPR to to recursive call.
(add_type_attribute): Ignore unnamed subtype of integral or FP.
(gen_subprogram_die): Use reg_loc_descriptor.
(dwarf2out_decl): Ignore nested functions.

From-SVN: r13939
parent 2e3f9f3d
...@@ -132,7 +132,7 @@ typedef struct dw_separate_line_info_struct ...@@ -132,7 +132,7 @@ typedef struct dw_separate_line_info_struct
dw_separate_line_info_entry; dw_separate_line_info_entry;
/* The dw_val_node describes an attibute's value, as it is /* The dw_val_node describes an attibute's value, as it is
represnted internally. */ represented internally. */
typedef struct dw_val_struct typedef struct dw_val_struct
{ {
dw_val_class val_class; dw_val_class val_class;
...@@ -1814,7 +1814,7 @@ decl_ultimate_origin (decl) ...@@ -1814,7 +1814,7 @@ decl_ultimate_origin (decl)
{ {
register tree immediate_origin = DECL_ABSTRACT_ORIGIN (decl); register tree immediate_origin = DECL_ABSTRACT_ORIGIN (decl);
if (immediate_origin == NULL) if (immediate_origin == NULL || immediate_origin == decl)
return NULL; return NULL;
else else
{ {
...@@ -2403,20 +2403,23 @@ equate_decl_number_to_die (decl, decl_die) ...@@ -2403,20 +2403,23 @@ equate_decl_number_to_die (decl, decl_die)
register unsigned num_allocated; register unsigned num_allocated;
if (decl_id >= decl_die_table_allocated) if (decl_id >= decl_die_table_allocated)
{ {
num_allocated = (((decl_id + 1) num_allocated
+ DECL_DIE_TABLE_INCREMENT - 1) = ((decl_id + 1 + DECL_DIE_TABLE_INCREMENT - 1)
/ DECL_DIE_TABLE_INCREMENT) / DECL_DIE_TABLE_INCREMENT)
* DECL_DIE_TABLE_INCREMENT; * DECL_DIE_TABLE_INCREMENT;
decl_die_table = (dw_die_ref *) xrealloc (decl_die_table,
decl_die_table
= (dw_die_ref *) xrealloc (decl_die_table,
sizeof (dw_die_ref) * num_allocated); sizeof (dw_die_ref) * num_allocated);
bzero (&decl_die_table[decl_die_table_allocated],
bzero ((char *) &decl_die_table[decl_die_table_allocated],
(num_allocated - decl_die_table_allocated) * sizeof (dw_die_ref)); (num_allocated - decl_die_table_allocated) * sizeof (dw_die_ref));
decl_die_table_allocated = num_allocated; decl_die_table_allocated = num_allocated;
} }
if (decl_id >= decl_die_table_in_use) if (decl_id >= decl_die_table_in_use)
{
decl_die_table_in_use = (decl_id + 1); decl_die_table_in_use = (decl_id + 1);
}
decl_die_table[decl_id] = decl_die; decl_die_table[decl_id] = decl_die;
} }
...@@ -2706,25 +2709,25 @@ build_abbrev_table (die) ...@@ -2706,25 +2709,25 @@ build_abbrev_table (die)
if (abbrev_die_table_in_use >= abbrev_die_table_allocated) if (abbrev_die_table_in_use >= abbrev_die_table_allocated)
{ {
n_alloc = abbrev_die_table_allocated + ABBREV_DIE_TABLE_INCREMENT; n_alloc = abbrev_die_table_allocated + ABBREV_DIE_TABLE_INCREMENT;
abbrev_die_table = (dw_die_ref *) abbrev_die_table
xmalloc (abbrev_die_table, = (dw_die_ref *) xmalloc (abbrev_die_table,
sizeof (dw_die_ref) * n_alloc); sizeof (dw_die_ref) * n_alloc);
bzero (&abbrev_die_table[abbrev_die_table_allocated],
bzero ((char *) &abbrev_die_table[abbrev_die_table_allocated],
(n_alloc - abbrev_die_table_allocated) * sizeof (dw_die_ref)); (n_alloc - abbrev_die_table_allocated) * sizeof (dw_die_ref));
abbrev_die_table_allocated = n_alloc; abbrev_die_table_allocated = n_alloc;
} }
++abbrev_die_table_in_use; ++abbrev_die_table_in_use;
abbrev_die_table[abbrev_id] = die; abbrev_die_table[abbrev_id] = die;
} }
die->die_abbrev = abbrev_id; die->die_abbrev = abbrev_id;
for (c = die->die_child; c != NULL; c = c->die_sib) for (c = die->die_child; c != NULL; c = c->die_sib)
{
build_abbrev_table (c); build_abbrev_table (c);
}
} }
/********************** DWARF Information Sizing ****************************/
/********************** DWARF Information Sizing *****************************/
/* Return the size of an unsigned LEB128 quantity. */ /* Return the size of an unsigned LEB128 quantity. */
inline unsigned long inline unsigned long
...@@ -2910,7 +2913,7 @@ constant_size (value) ...@@ -2910,7 +2913,7 @@ constant_size (value)
log = log / 8; log = log / 8;
log = 1 << (floor_log2 (log) + 1); log = 1 << (floor_log2 (log) + 1);
return log; return MIN (log, 4);
} }
/* Return the size of a DIE, as it is represented in the /* Return the size of a DIE, as it is represented in the
...@@ -3273,6 +3276,8 @@ value_format (v) ...@@ -3273,6 +3276,8 @@ value_format (v)
return DW_FORM_data2; return DW_FORM_data2;
case 4: case 4:
return DW_FORM_data4; return DW_FORM_data4;
case 8:
return DW_FORM_data8;
default: default:
abort (); abort ();
} }
...@@ -3982,7 +3987,8 @@ dwarf2out_frame_debug (insn) ...@@ -3982,7 +3987,8 @@ dwarf2out_frame_debug (insn)
case REG: case REG:
assert (cfa_reg == REGNO (src)); assert (cfa_reg == REGNO (src));
assert (REGNO (dest) == STACK_POINTER_REGNUM assert (REGNO (dest) == STACK_POINTER_REGNUM
|| frame_pointer_needed && REGNO (dest) == FRAME_POINTER_REGNUM); || (frame_pointer_needed
&& REGNO (dest) == HARD_FRAME_POINTER_REGNUM));
cfa_reg = REGNO (dest); cfa_reg = REGNO (dest);
break; break;
...@@ -5344,7 +5350,7 @@ based_loc_descr (reg, offset) ...@@ -5344,7 +5350,7 @@ based_loc_descr (reg, offset)
registers, since the RTL for local variables is relative to one of registers, since the RTL for local variables is relative to one of
them. */ them. */
register unsigned fp_reg = DBX_REGISTER_NUMBER (frame_pointer_needed register unsigned fp_reg = DBX_REGISTER_NUMBER (frame_pointer_needed
? FRAME_POINTER_REGNUM ? HARD_FRAME_POINTER_REGNUM
: STACK_POINTER_REGNUM); : STACK_POINTER_REGNUM);
if (reg == fp_reg) if (reg == fp_reg)
{ {
...@@ -6066,11 +6072,11 @@ add_bound_info (subrange_die, bound_attr, bound) ...@@ -6066,11 +6072,11 @@ add_bound_info (subrange_die, bound_attr, bound)
add_AT_unsigned (subrange_die, bound_attr, bound_value); add_AT_unsigned (subrange_die, bound_attr, bound_value);
break; break;
/* Dynamic bounds may be represented by NOP_EXPR nodes containing case CONVERT_EXPR:
SAVE_EXPR nodes. */
case NOP_EXPR: case NOP_EXPR:
bound = TREE_OPERAND (bound, 0); case NON_LVALUE_EXPR:
/* ... fall thru... */ add_bound_info (subrange_die, bound_attr, TREE_OPERAND (bound, 0));
break;
case SAVE_EXPR: case SAVE_EXPR:
/* If optimization is turned on, the SAVE_EXPRs that describe how to /* If optimization is turned on, the SAVE_EXPRs that describe how to
...@@ -6106,9 +6112,6 @@ add_bound_info (subrange_die, bound_attr, bound) ...@@ -6106,9 +6112,6 @@ add_bound_info (subrange_die, bound_attr, bound)
} }
/* else leave out the attribute. */ /* else leave out the attribute. */
break; break;
default:
abort ();
} }
} }
...@@ -6454,18 +6457,20 @@ add_type_attribute (object_die, type, decl_const, decl_volatile, context_die) ...@@ -6454,18 +6457,20 @@ add_type_attribute (object_die, type, decl_const, decl_volatile, context_die)
register enum tree_code code = TREE_CODE (type); register enum tree_code code = TREE_CODE (type);
register dw_die_ref type_die = NULL; register dw_die_ref type_die = NULL;
/* If this type is an unnamed subtype of an integral or floating-point
type, use the inner type. */
if ((code == INTEGER_TYPE || code == REAL_TYPE)
&& TREE_TYPE (type) != 0 && TYPE_NAME (type) == 0)
type = TREE_TYPE (type), code = TREE_CODE (type);
if (code == ERROR_MARK) if (code == ERROR_MARK)
{
return; return;
}
/* Handle a special case. For functions whose return type is void, we /* Handle a special case. For functions whose return type is void, we
generate *no* type attribute. (Note that no object may have type generate *no* type attribute. (Note that no object may have type
`void', so this only applies to function return types). */ `void', so this only applies to function return types). */
if (code == VOID_TYPE) if (code == VOID_TYPE)
{
return; return;
}
type_die = modified_type_die (type, type_die = modified_type_die (type,
decl_const || TYPE_READONLY (type), decl_const || TYPE_READONLY (type),
...@@ -6907,7 +6912,7 @@ gen_subprogram_die (decl, context_die) ...@@ -6907,7 +6912,7 @@ gen_subprogram_die (decl, context_die)
register tree origin = decl_ultimate_origin (decl); register tree origin = decl_ultimate_origin (decl);
register dw_die_ref subr_die; register dw_die_ref subr_die;
register dw_loc_descr_ref fp_loc = NULL; register dw_loc_descr_ref fp_loc = NULL;
register unsigned fp_reg; register rtx fp_reg;
register tree fn_arg_types; register tree fn_arg_types;
register tree outer_scope; register tree outer_scope;
register dw_die_ref old_die = lookup_decl_die (decl); register dw_die_ref old_die = lookup_decl_die (decl);
...@@ -7041,12 +7046,9 @@ gen_subprogram_die (decl, context_die) ...@@ -7041,12 +7046,9 @@ gen_subprogram_die (decl, context_die)
/* Define the "frame base" location for this routine. We use the /* Define the "frame base" location for this routine. We use the
frame pointer or stack pointer registers, since the RTL for local frame pointer or stack pointer registers, since the RTL for local
variables is relative to one of them. */ variables is relative to one of them. */
fp_reg = DBX_REGISTER_NUMBER (frame_pointer_needed fp_reg
? FRAME_POINTER_REGNUM = frame_pointer_needed ? hard_frame_pointer_rtx : stack_pointer_rtx;
: STACK_POINTER_REGNUM); add_AT_loc (subr_die, DW_AT_frame_base, reg_loc_descriptor (fp_reg));
assert (fp_reg >= 0 && fp_reg <= 31);
fp_loc = new_loc_descr (DW_OP_reg0 + fp_reg);
add_AT_loc (subr_die, DW_AT_frame_base, fp_loc);
if (current_function_needs_context) if (current_function_needs_context)
add_AT_loc (subr_die, DW_AT_static_link, add_AT_loc (subr_die, DW_AT_static_link,
...@@ -8168,9 +8170,7 @@ dwarf2out_decl (decl) ...@@ -8168,9 +8170,7 @@ dwarf2out_decl (decl)
builtin function. Explicit programmer-supplied declarations of builtin function. Explicit programmer-supplied declarations of
these same functions should NOT be ignored however. */ these same functions should NOT be ignored however. */
if (DECL_EXTERNAL (decl) && DECL_FUNCTION_CODE (decl)) if (DECL_EXTERNAL (decl) && DECL_FUNCTION_CODE (decl))
{
return; return;
}
/* What we would really like to do here is to filter out all mere /* What we would really like to do here is to filter out all mere
file-scope declarations of file-scope functions which are never file-scope declarations of file-scope functions which are never
...@@ -8198,15 +8198,13 @@ dwarf2out_decl (decl) ...@@ -8198,15 +8198,13 @@ dwarf2out_decl (decl)
within include files which also contain within include files which also contain
`#pragma interface' pragmas. */ `#pragma interface' pragmas. */
if (DECL_INITIAL (decl) == NULL_TREE) if (DECL_INITIAL (decl) == NULL_TREE)
{
return; return;
}
/* If we're a nested function, initially use a parent of NULL; if we're /* Ignore nested functions, since they will be written in decl_for_scope.
a plain function, this will be fixed up in decls_for_scope. If ??? There was an old comment here about methods, which now need to
we're a method, it will be ignored, since we already have a DIE. */ be handled. */
if (decl_function_context (decl)) if (decl_function_context (decl))
context_die = NULL; return;
break; break;
...@@ -8253,7 +8251,8 @@ dwarf2out_decl (decl) ...@@ -8253,7 +8251,8 @@ dwarf2out_decl (decl)
/* If we're a function-scope tag, initially use a parent of NULL; /* If we're a function-scope tag, initially use a parent of NULL;
this will be fixed up in decls_for_scope. */ this will be fixed up in decls_for_scope. */
if (decl_function_context (decl)) if (decl_function_context (decl))
context_die = NULL; return;
/* context_die = NULL; */
break; break;
...@@ -8525,7 +8524,7 @@ dwarf2out_init (asm_out_file, main_input_filename) ...@@ -8525,7 +8524,7 @@ dwarf2out_init (asm_out_file, main_input_filename)
/* Allocate the initial hunk of the file_table. */ /* Allocate the initial hunk of the file_table. */
file_table = (char **) xmalloc (FILE_TABLE_INCREMENT * sizeof (char *)); file_table = (char **) xmalloc (FILE_TABLE_INCREMENT * sizeof (char *));
bzero (file_table, FILE_TABLE_INCREMENT * sizeof (char *)); bzero ((char *) file_table, FILE_TABLE_INCREMENT * sizeof (char *));
file_table_allocated = FILE_TABLE_INCREMENT; file_table_allocated = FILE_TABLE_INCREMENT;
/* skip the first entry - file numbers begin at 1 */ /* skip the first entry - file numbers begin at 1 */
file_table_in_use = 1; file_table_in_use = 1;
...@@ -8533,14 +8532,16 @@ dwarf2out_init (asm_out_file, main_input_filename) ...@@ -8533,14 +8532,16 @@ dwarf2out_init (asm_out_file, main_input_filename)
/* Allocate the initial hunk of the decl_die_table. */ /* Allocate the initial hunk of the decl_die_table. */
decl_die_table decl_die_table
= (dw_die_ref *) xmalloc (DECL_DIE_TABLE_INCREMENT * sizeof (dw_die_ref)); = (dw_die_ref *) xmalloc (DECL_DIE_TABLE_INCREMENT * sizeof (dw_die_ref));
bzero (decl_die_table, DECL_DIE_TABLE_INCREMENT * sizeof (dw_die_ref)); bzero ((char *) decl_die_table,
DECL_DIE_TABLE_INCREMENT * sizeof (dw_die_ref));
decl_die_table_allocated = DECL_DIE_TABLE_INCREMENT; decl_die_table_allocated = DECL_DIE_TABLE_INCREMENT;
decl_die_table_in_use = 0; decl_die_table_in_use = 0;
/* Allocate the initial hunk of the decl_scope_table. */ /* Allocate the initial hunk of the decl_scope_table. */
decl_scope_table decl_scope_table
= (tree *) xmalloc (DECL_SCOPE_TABLE_INCREMENT * sizeof (tree)); = (tree *) xmalloc (DECL_SCOPE_TABLE_INCREMENT * sizeof (tree));
bzero (decl_scope_table, DECL_SCOPE_TABLE_INCREMENT * sizeof (tree)); bzero ((char *) decl_scope_table,
DECL_SCOPE_TABLE_INCREMENT * sizeof (tree));
decl_scope_table_allocated = DECL_SCOPE_TABLE_INCREMENT; decl_scope_table_allocated = DECL_SCOPE_TABLE_INCREMENT;
decl_scope_depth = 0; decl_scope_depth = 0;
...@@ -8548,7 +8549,8 @@ dwarf2out_init (asm_out_file, main_input_filename) ...@@ -8548,7 +8549,8 @@ dwarf2out_init (asm_out_file, main_input_filename)
abbrev_die_table abbrev_die_table
= (dw_die_ref *) xmalloc (ABBREV_DIE_TABLE_INCREMENT = (dw_die_ref *) xmalloc (ABBREV_DIE_TABLE_INCREMENT
* sizeof (dw_die_ref)); * sizeof (dw_die_ref));
bzero (abbrev_die_table, ABBREV_DIE_TABLE_INCREMENT * sizeof (dw_die_ref)); bzero ((char *) abbrev_die_table,
ABBREV_DIE_TABLE_INCREMENT * sizeof (dw_die_ref));
abbrev_die_table_allocated = ABBREV_DIE_TABLE_INCREMENT; abbrev_die_table_allocated = ABBREV_DIE_TABLE_INCREMENT;
/* zero-th entry is allocated, but unused */ /* zero-th entry is allocated, but unused */
abbrev_die_table_in_use = 1; abbrev_die_table_in_use = 1;
...@@ -8557,15 +8559,16 @@ dwarf2out_init (asm_out_file, main_input_filename) ...@@ -8557,15 +8559,16 @@ dwarf2out_init (asm_out_file, main_input_filename)
line_info_table line_info_table
= (dw_line_info_ref) xmalloc (LINE_INFO_TABLE_INCREMENT = (dw_line_info_ref) xmalloc (LINE_INFO_TABLE_INCREMENT
* sizeof (dw_line_info_entry)); * sizeof (dw_line_info_entry));
bzero (line_info_table, LINE_INFO_TABLE_INCREMENT bzero ((char *) line_info_table,
* sizeof (dw_line_info_entry)); LINE_INFO_TABLE_INCREMENT * sizeof (dw_line_info_entry));
line_info_table_allocated = LINE_INFO_TABLE_INCREMENT; line_info_table_allocated = LINE_INFO_TABLE_INCREMENT;
/* zero-th entry is allocated, but unused */ /* zero-th entry is allocated, but unused */
line_info_table_in_use = 1; line_info_table_in_use = 1;
/* Allocate the initial hunk of the fde_table. */ /* Allocate the initial hunk of the fde_table. */
fde_table = (dw_fde_ref) xmalloc (FDE_TABLE_INCREMENT * sizeof (dw_fde_node)); fde_table
bzero (fde_table, FDE_TABLE_INCREMENT * sizeof (dw_fde_node)); = (dw_fde_ref) xmalloc (FDE_TABLE_INCREMENT * sizeof (dw_fde_node));
bzero ((char *) fde_table, FDE_TABLE_INCREMENT * sizeof (dw_fde_node));
fde_table_allocated = FDE_TABLE_INCREMENT; fde_table_allocated = FDE_TABLE_INCREMENT;
fde_table_in_use = 0; fde_table_in_use = 0;
......
Markdown is supported
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