#include "target.h"
#include "langhooks.h"
#include "hashtab.h"
+#include "cgraph.h"
#ifdef DWARF2_DEBUGGING_INFO
static void dwarf2out_source_line (unsigned int, const char *);
#define PTR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
#endif
-/* Default version of targetm.eh_frame_section. Note this must appear
- outside the DWARF2_DEBUGGING_INFO || DWARF2_UNWIND_INFO macro
- guards. */
+/* Various versions of targetm.eh_frame_section. Note these must appear
+ outside the DWARF2_DEBUGGING_INFO || DWARF2_UNWIND_INFO macro guards. */
+/* Version of targetm.eh_frame_section for systems with named sections. */
void
-default_eh_frame_section (void)
+named_section_eh_frame_section (void)
{
#ifdef EH_FRAME_SECTION_NAME
#ifdef HAVE_LD_RO_RW_SECTION_MIXING
#else
named_section_flags (EH_FRAME_SECTION_NAME, SECTION_WRITE);
#endif
-#else
+#endif
+}
+
+/* Version of targetm.eh_frame_section for systems using collect2. */
+void
+collect2_eh_frame_section (void)
+{
tree label = get_file_function_name ('F');
data_section ();
ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
(*targetm.asm_out.globalize_label) (asm_out_file, IDENTIFIER_POINTER (label));
ASM_OUTPUT_LABEL (asm_out_file, IDENTIFIER_POINTER (label));
+}
+
+/* Default version of targetm.eh_frame_section. */
+void
+default_eh_frame_section (void)
+{
+#ifdef EH_FRAME_SECTION_NAME
+ named_section_eh_frame_section ();
+#else
+ collect2_eh_frame_section ();
#endif
}
typedef union dw_cfi_oprnd_struct GTY(())
{
unsigned long GTY ((tag ("dw_cfi_oprnd_reg_num"))) dw_cfi_reg_num;
- long int GTY ((tag ("dw_cfi_oprnd_offset"))) dw_cfi_offset;
+ HOST_WIDE_INT GTY ((tag ("dw_cfi_oprnd_offset"))) dw_cfi_offset;
const char * GTY ((tag ("dw_cfi_oprnd_addr"))) dw_cfi_addr;
struct dw_loc_descr_struct * GTY ((tag ("dw_cfi_oprnd_loc"))) dw_cfi_loc;
}
typedef struct cfa_loc GTY(())
{
unsigned long reg;
- long offset;
- long base_offset;
+ HOST_WIDE_INT offset;
+ HOST_WIDE_INT base_offset;
int indirect; /* 1 if CFA is accessed via a dereference. */
} dw_cfa_location;
static void add_fde_cfi (const char *, dw_cfi_ref);
static void lookup_cfa_1 (dw_cfi_ref, dw_cfa_location *);
static void lookup_cfa (dw_cfa_location *);
-static void reg_save (const char *, unsigned, unsigned, long);
+static void reg_save (const char *, unsigned, unsigned, HOST_WIDE_INT);
static void initial_return_save (rtx);
-static long stack_adjust_offset (rtx);
+static HOST_WIDE_INT stack_adjust_offset (rtx);
static void output_cfi (dw_cfi_ref, dw_fde_ref, int);
static void output_call_frame_info (int);
static void dwarf2out_stack_adjust (rtx);
-static void queue_reg_save (const char *, rtx, long);
+static void queue_reg_save (const char *, rtx, HOST_WIDE_INT);
static void flush_queued_reg_saves (void);
static bool clobbers_queued_reg_save (rtx);
static void dwarf2out_frame_debug_expr (rtx, const char *);
enum machine_mode mode = TYPE_MODE (char_type_node);
rtx addr = expand_expr (address, NULL_RTX, VOIDmode, 0);
rtx mem = gen_rtx_MEM (BLKmode, addr);
+ bool wrote_return_column = false;
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (DWARF_FRAME_REGNUM (i) < DWARF_FRAME_REGISTERS)
{
HOST_WIDE_INT offset = DWARF_FRAME_REGNUM (i) * GET_MODE_SIZE (mode);
- HOST_WIDE_INT size = GET_MODE_SIZE (reg_raw_mode[i]);
+ enum machine_mode save_mode = reg_raw_mode[i];
+ HOST_WIDE_INT size;
+ if (HARD_REGNO_CALL_PART_CLOBBERED (i, save_mode))
+ save_mode = choose_hard_reg_mode (i, 1, true);
+ if (DWARF_FRAME_REGNUM (i) == DWARF_FRAME_RETURN_COLUMN)
+ {
+ if (save_mode == VOIDmode)
+ continue;
+ wrote_return_column = true;
+ }
+ size = GET_MODE_SIZE (save_mode);
if (offset < 0)
continue;
emit_move_insn (adjust_address (mem, mode, offset), GEN_INT (size));
}
+
+#ifdef DWARF_ALT_FRAME_RETURN_COLUMN
+ if (! wrote_return_column)
+ abort ();
+ i = DWARF_ALT_FRAME_RETURN_COLUMN;
+ wrote_return_column = false;
+#else
+ i = DWARF_FRAME_RETURN_COLUMN;
+#endif
+
+ if (! wrote_return_column)
+ {
+ enum machine_mode save_mode = Pmode;
+ HOST_WIDE_INT offset = i * GET_MODE_SIZE (mode);
+ HOST_WIDE_INT size = GET_MODE_SIZE (save_mode);
+ emit_move_insn (adjust_address (mem, mode, offset), GEN_INT (size));
+ }
}
/* Convert a DWARF call frame info. operation to its string name */
static inline dw_cfi_ref
new_cfi (void)
{
- dw_cfi_ref cfi = (dw_cfi_ref) ggc_alloc (sizeof (dw_cfi_node));
+ dw_cfi_ref cfi = ggc_alloc (sizeof (dw_cfi_node));
cfi->dw_cfi_next = NULL;
cfi->dw_cfi_oprnd1.dw_cfi_reg_num = 0;
static dw_cfa_location cfa_store;
/* The running total of the size of arguments pushed onto the stack. */
-static long args_size;
+static HOST_WIDE_INT args_size;
/* The last args_size we actually output. */
-static long old_args_size;
+static HOST_WIDE_INT old_args_size;
/* Entry point to update the canonical frame address (CFA).
LABEL is passed to add_fde_cfi. The value of CFA is now to be
calculated from REG+OFFSET. */
void
-dwarf2out_def_cfa (const char *label, unsigned int reg, long int offset)
+dwarf2out_def_cfa (const char *label, unsigned int reg, HOST_WIDE_INT offset)
{
dw_cfa_location loc;
loc.indirect = 0;
otherwise it is saved in SREG. */
static void
-reg_save (const char *label, unsigned int reg, unsigned int sreg, long int offset)
+reg_save (const char *label, unsigned int reg, unsigned int sreg, HOST_WIDE_INT offset)
{
dw_cfi_ref cfi = new_cfi ();
DWARF_CIE_DATA_ALIGNMENT, there is either a bug in the
definition of DWARF_CIE_DATA_ALIGNMENT, or a bug in the machine
description. */
- long check_offset = offset / DWARF_CIE_DATA_ALIGNMENT;
+ HOST_WIDE_INT check_offset = offset / DWARF_CIE_DATA_ALIGNMENT;
if (check_offset * DWARF_CIE_DATA_ALIGNMENT != offset)
abort ();
pushed onto the stack. */
void
-dwarf2out_args_size (const char *label, long int size)
+dwarf2out_args_size (const char *label, HOST_WIDE_INT size)
{
dw_cfi_ref cfi;
number. LABEL and OFFSET are passed to reg_save. */
void
-dwarf2out_reg_save (const char *label, unsigned int reg, long int offset)
+dwarf2out_reg_save (const char *label, unsigned int reg, HOST_WIDE_INT offset)
{
reg_save (label, DWARF_FRAME_REGNUM (reg), -1, offset);
}
LABEL and OFFSET are passed to reg_save. */
void
-dwarf2out_return_save (const char *label, long int offset)
+dwarf2out_return_save (const char *label, HOST_WIDE_INT offset)
{
reg_save (label, DWARF_FRAME_RETURN_COLUMN, -1, offset);
}
/* Given a SET, calculate the amount of stack adjustment it
contains. */
-static long
+static HOST_WIDE_INT
stack_adjust_offset (rtx pattern)
{
rtx src = SET_SRC (pattern);
{
struct queued_reg_save *next;
rtx reg;
- long cfa_offset;
+ HOST_WIDE_INT cfa_offset;
};
static GTY(()) struct queued_reg_save *queued_reg_saves;
static const char *last_reg_save_label;
static void
-queue_reg_save (const char *label, rtx reg, long int offset)
+queue_reg_save (const char *label, rtx reg, HOST_WIDE_INT offset)
{
struct queued_reg_save *q = ggc_alloc (sizeof (*q));
if (cfi->dw_cfi_opc == DW_CFA_advance_loc)
dw2_asm_output_data (1, (cfi->dw_cfi_opc
| (cfi->dw_cfi_oprnd1.dw_cfi_offset & 0x3f)),
- "DW_CFA_advance_loc 0x%lx",
+ "DW_CFA_advance_loc " HOST_WIDE_INT_PRINT_HEX,
cfi->dw_cfi_oprnd1.dw_cfi_offset);
else if (cfi->dw_cfi_opc == DW_CFA_offset)
{
dwarf2out_frame_init (void)
{
/* Allocate the initial hunk of the fde_table. */
- fde_table = (dw_fde_ref) ggc_alloc_cleared (FDE_TABLE_INCREMENT
- * sizeof (dw_fde_node));
+ fde_table = ggc_alloc_cleared (FDE_TABLE_INCREMENT * sizeof (dw_fde_node));
fde_table_allocated = FDE_TABLE_INCREMENT;
fde_table_in_use = 0;
union dw_val_struct_union
{
rtx GTY ((tag ("dw_val_class_addr"))) val_addr;
- long unsigned GTY ((tag ("dw_val_class_offset"))) val_offset;
+ unsigned HOST_WIDE_INT GTY ((tag ("dw_val_class_offset"))) val_offset;
dw_loc_list_ref GTY ((tag ("dw_val_class_loc_list"))) val_loc_list;
dw_loc_descr_ref GTY ((tag ("dw_val_class_loc"))) val_loc;
- long int GTY ((default (""))) val_int;
- long unsigned GTY ((tag ("dw_val_class_unsigned_const"))) val_unsigned;
+ HOST_WIDE_INT GTY ((default (""))) val_int;
+ unsigned HOST_WIDE_INT GTY ((tag ("dw_val_class_unsigned_const"))) val_unsigned;
dw_long_long_const GTY ((tag ("dw_val_class_long_long"))) val_long_long;
dw_float_const GTY ((tag ("dw_val_class_float"))) val_float;
struct dw_val_die_union
static const char *dwarf_stack_op_name (unsigned);
static dw_loc_descr_ref new_loc_descr (enum dwarf_location_atom,
- unsigned long, unsigned long);
+ unsigned HOST_WIDE_INT, unsigned HOST_WIDE_INT);
static void add_loc_descr (dw_loc_descr_ref *, dw_loc_descr_ref);
static unsigned long size_of_loc_descr (dw_loc_descr_ref);
static unsigned long size_of_locs (dw_loc_descr_ref);
together to form more complicated location (address) descriptions. */
static inline dw_loc_descr_ref
-new_loc_descr (enum dwarf_location_atom op, long unsigned int oprnd1,
- long unsigned int oprnd2)
+new_loc_descr (enum dwarf_location_atom op, unsigned HOST_WIDE_INT oprnd1,
+ unsigned HOST_WIDE_INT oprnd2)
{
- dw_loc_descr_ref descr
- = (dw_loc_descr_ref) ggc_alloc_cleared (sizeof (dw_loc_descr_node));
+ dw_loc_descr_ref descr = ggc_alloc_cleared (sizeof (dw_loc_descr_node));
descr->dw_loc_opc = op;
descr->dw_loc_oprnd1.val_class = dw_val_class_unsigned_const;
/* Record the root of the DIE's built for the current compilation unit. */
static GTY(()) dw_die_ref comp_unit_die;
-#ifdef DWARF2_DEBUGGING_INFO
-/* We need special handling in dwarf2out_start_source_file if it is
- first one. */
-static int is_main_source;
-#endif
-
/* A list of DIEs with a NULL parent waiting to be relocated. */
static GTY(()) limbo_die_node *limbo_die_list;
static int comp_unit_has_inlines;
#endif
-/* Number of file tables emited in maybe_emit_file(). */
+/* Number of file tables emitted in maybe_emit_file(). */
static GTY(()) int emitcount = 0;
/* Number of internal labels generated by gen_internal_sym(). */
static inline enum dw_val_class AT_class (dw_attr_ref);
static void add_AT_flag (dw_die_ref, enum dwarf_attribute, unsigned);
static inline unsigned AT_flag (dw_attr_ref);
-static void add_AT_int (dw_die_ref, enum dwarf_attribute, long);
-static inline long int AT_int (dw_attr_ref);
-static void add_AT_unsigned (dw_die_ref, enum dwarf_attribute, unsigned long);
-static inline unsigned long AT_unsigned (dw_attr_ref);
+static void add_AT_int (dw_die_ref, enum dwarf_attribute, HOST_WIDE_INT);
+static inline HOST_WIDE_INT AT_int (dw_attr_ref);
+static void add_AT_unsigned (dw_die_ref, enum dwarf_attribute, unsigned HOST_WIDE_INT);
+static inline unsigned HOST_WIDE_INT AT_unsigned (dw_attr_ref);
static void add_AT_long_long (dw_die_ref, enum dwarf_attribute, unsigned long,
unsigned long);
static void add_AT_float (dw_die_ref, enum dwarf_attribute, unsigned, long *);
static inline rtx AT_addr (dw_attr_ref);
static void add_AT_lbl_id (dw_die_ref, enum dwarf_attribute, const char *);
static void add_AT_lbl_offset (dw_die_ref, enum dwarf_attribute, const char *);
-static void add_AT_offset (dw_die_ref, enum dwarf_attribute, unsigned long);
+static void add_AT_offset (dw_die_ref, enum dwarf_attribute,
+ unsigned HOST_WIDE_INT);
static void add_AT_range_list (dw_die_ref, enum dwarf_attribute,
unsigned long);
static inline const char *AT_lbl (dw_attr_ref);
static dw_loc_descr_ref one_reg_loc_descriptor (unsigned int);
static dw_loc_descr_ref multiple_reg_loc_descriptor (rtx, rtx);
static dw_loc_descr_ref int_loc_descriptor (HOST_WIDE_INT);
-static dw_loc_descr_ref based_loc_descr (unsigned, long);
+static dw_loc_descr_ref based_loc_descr (unsigned, HOST_WIDE_INT);
static int is_based_loc (rtx);
static dw_loc_descr_ref mem_loc_descriptor (rtx, enum machine_mode mode);
static dw_loc_descr_ref concat_loc_descriptor (rtx, rtx);
#endif
/* Section flags for .debug_str section. */
-#ifdef HAVE_GAS_SHF_MERGE
#define DEBUG_STR_SECTION_FLAGS \
- (flag_merge_constants \
+ (HAVE_GAS_SHF_MERGE && flag_merge_constants \
? SECTION_DEBUG | SECTION_MERGE | SECTION_STRINGS | 1 \
: SECTION_DEBUG)
-#else
-#define DEBUG_STR_SECTION_FLAGS SECTION_DEBUG
-#endif
/* Labels we insert at beginning sections we can reference instead of
the section names themselves. */
static inline void
add_AT_flag (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int flag)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
/* Add a signed integer attribute value to a DIE. */
static inline void
-add_AT_int (dw_die_ref die, enum dwarf_attribute attr_kind, long int int_val)
+add_AT_int (dw_die_ref die, enum dwarf_attribute attr_kind, HOST_WIDE_INT int_val)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
add_dwarf_attr (die, attr);
}
-static inline long int
+static inline HOST_WIDE_INT
AT_int (dw_attr_ref a)
{
if (a && AT_class (a) == dw_val_class_const)
static inline void
add_AT_unsigned (dw_die_ref die, enum dwarf_attribute attr_kind,
- long unsigned int unsigned_val)
+ unsigned HOST_WIDE_INT unsigned_val)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
add_dwarf_attr (die, attr);
}
-static inline unsigned long
+static inline unsigned HOST_WIDE_INT
AT_unsigned (dw_attr_ref a)
{
if (a && AT_class (a) == dw_val_class_unsigned_const)
add_AT_long_long (dw_die_ref die, enum dwarf_attribute attr_kind,
long unsigned int val_hi, long unsigned int val_low)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
add_AT_float (dw_die_ref die, enum dwarf_attribute attr_kind,
unsigned int length, long int *array)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
static inline void
add_AT_string (dw_die_ref die, enum dwarf_attribute attr_kind, const char *str)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
struct indirect_string_node *node;
void **slot;
static inline void
add_AT_die_ref (dw_die_ref die, enum dwarf_attribute attr_kind, dw_die_ref targ_die)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
static inline void
add_AT_fde_ref (dw_die_ref die, enum dwarf_attribute attr_kind, unsigned int targ_fde)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
static inline void
add_AT_loc (dw_die_ref die, enum dwarf_attribute attr_kind, dw_loc_descr_ref loc)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
static inline void
add_AT_loc_list (dw_die_ref die, enum dwarf_attribute attr_kind, dw_loc_list_ref loc_list)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
static inline void
add_AT_addr (dw_die_ref die, enum dwarf_attribute attr_kind, rtx addr)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
static inline void
add_AT_lbl_id (dw_die_ref die, enum dwarf_attribute attr_kind, const char *lbl_id)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
static inline void
add_AT_lbl_offset (dw_die_ref die, enum dwarf_attribute attr_kind, const char *label)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
/* Add an offset attribute value to a DIE. */
static inline void
-add_AT_offset (dw_die_ref die, enum dwarf_attribute attr_kind, long unsigned int offset)
+add_AT_offset (dw_die_ref die, enum dwarf_attribute attr_kind,
+ unsigned HOST_WIDE_INT offset)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
add_AT_range_list (dw_die_ref die, enum dwarf_attribute attr_kind,
long unsigned int offset)
{
- dw_attr_ref attr = (dw_attr_ref) ggc_alloc (sizeof (dw_attr_node));
+ dw_attr_ref attr = ggc_alloc (sizeof (dw_attr_node));
attr->dw_attr_next = NULL;
attr->dw_attr = attr_kind;
static inline dw_die_ref
new_die (enum dwarf_tag tag_value, dw_die_ref parent_die, tree t)
{
- dw_die_ref die = (dw_die_ref) ggc_alloc_cleared (sizeof (die_node));
+ dw_die_ref die = ggc_alloc_cleared (sizeof (die_node));
die->die_tag = tag_value;
decl_die_table = ggc_realloc (decl_die_table,
sizeof (dw_die_ref) * num_allocated);
- memset ((char *) &decl_die_table[decl_die_table_allocated], 0,
+ memset (&decl_die_table[decl_die_table_allocated], 0,
(num_allocated - decl_die_table_allocated) * sizeof (dw_die_ref));
decl_die_table_allocated = num_allocated;
}
fprintf (outfile, "range list");
break;
case dw_val_class_const:
- fprintf (outfile, "%ld", AT_int (a));
+ fprintf (outfile, HOST_WIDE_INT_PRINT_DEC, AT_int (a));
break;
case dw_val_class_unsigned_const:
- fprintf (outfile, "%lu", AT_unsigned (a));
+ fprintf (outfile, HOST_WIDE_INT_PRINT_UNSIGNED, AT_unsigned (a));
break;
case dw_val_class_long_long:
fprintf (outfile, "constant (%lu,%lu)",
{
const char *die_name = get_AT_string (unit_die, DW_AT_name);
const char *base = die_name ? lbasename (die_name) : "anonymous";
- char *name = (char *) alloca (strlen (base) + 64);
+ char *name = alloca (strlen (base) + 64);
char *p;
int i, mark;
unsigned char checksum[16];
abbrev_die_table = ggc_realloc (abbrev_die_table,
sizeof (dw_die_ref) * n_alloc);
- memset ((char *) &abbrev_die_table[abbrev_die_table_allocated], 0,
+ memset (&abbrev_die_table[abbrev_die_table_allocated], 0,
(n_alloc - abbrev_die_table_allocated) * sizeof (dw_die_ref));
abbrev_die_table_allocated = n_alloc;
}
{
char *p = strchr (ranges_section_label, '\0');
- sprintf (p, "+0x%lx", a->dw_attr_val.v.val_offset);
+ sprintf (p, "+" HOST_WIDE_INT_PRINT_HEX,
+ a->dw_attr_val.v.val_offset);
dw2_asm_output_offset (DWARF_OFFSET_SIZE, ranges_section_label,
"%s", name);
*p = '\0';
oldsym = die->die_symbol;
if (oldsym)
{
- tmp = (char *) alloca (strlen (oldsym) + 24);
+ tmp = alloca (strlen (oldsym) + 24);
sprintf (tmp, ".gnu.linkonce.wi.%s", oldsym);
secname = tmp;
{
pubname_table_allocated += PUBNAME_TABLE_INCREMENT;
pubname_table
- = (pubname_ref) ggc_realloc (pubname_table,
- (pubname_table_allocated
- * sizeof (pubname_entry)));
+ = ggc_realloc (pubname_table,
+ (pubname_table_allocated * sizeof (pubname_entry)));
memset (pubname_table + pubname_table_in_use, 0,
PUBNAME_TABLE_INCREMENT * sizeof (pubname_entry));
}
if (in_use == ranges_table_allocated)
{
ranges_table_allocated += RANGES_TABLE_INCREMENT;
- ranges_table = (dw_ranges_ref)
- ggc_realloc (ranges_table, (ranges_table_allocated
- * sizeof (struct dw_ranges_struct)));
+ ranges_table
+ = ggc_realloc (ranges_table, (ranges_table_allocated
+ * sizeof (struct dw_ranges_struct)));
memset (ranges_table + ranges_table_in_use, 0,
RANGES_TABLE_INCREMENT * sizeof (struct dw_ranges_struct));
}
}
/* Allocate the various arrays we need. */
- files = (struct file_info *) alloca (VARRAY_ACTIVE_SIZE (file_table)
- * sizeof (struct file_info));
- dirs = (struct dir_info *) alloca (VARRAY_ACTIVE_SIZE (file_table)
- * sizeof (struct dir_info));
+ files = alloca (VARRAY_ACTIVE_SIZE (file_table) * sizeof (struct file_info));
+ dirs = alloca (VARRAY_ACTIVE_SIZE (file_table) * sizeof (struct dir_info));
/* Sort the file names. */
for (i = 1; i < VARRAY_ACTIVE_SIZE (file_table); i++)
where we would have to check out every combination of every single
possible prefix. Instead we use a heuristic which provides nearly optimal
results in most cases and never is much off. */
- saved = (int *) alloca (ndirs * sizeof (int));
- savehere = (int *) alloca (ndirs * sizeof (int));
+ saved = alloca (ndirs * sizeof (int));
+ savehere = alloca (ndirs * sizeof (int));
memset (saved, '\0', ndirs * sizeof (saved[0]));
for (i = 0; i < ndirs; i++)
/* We have to emit them in the order they appear in the file_table array
since the index is used in the debug info generation. To do this
efficiently we generate a back-mapping of the indices first. */
- backmap = (int *) alloca (VARRAY_ACTIVE_SIZE (file_table) * sizeof (int));
+ backmap = alloca (VARRAY_ACTIVE_SIZE (file_table) * sizeof (int));
for (i = 1; i < VARRAY_ACTIVE_SIZE (file_table); i++)
{
backmap[files[i].file_idx] = i;
/* Return a location descriptor that designates a base+offset location. */
static dw_loc_descr_ref
-based_loc_descr (unsigned int reg, long int offset)
+based_loc_descr (unsigned int reg, HOST_WIDE_INT offset)
{
dw_loc_descr_ref loc_result;
/* For the "frame base", we use the frame pointer or stack pointer
return 0;
break;
+ case CONSTRUCTOR:
+ {
+ /* Get an RTL for this, if something has been emitted. */
+ rtx rtl = lookup_constant_def (loc);
+ enum machine_mode mode;
+
+ if (GET_CODE (rtl) != MEM)
+ return 0;
+ mode = GET_MODE (rtl);
+ rtl = XEXP (rtl, 0);
+
+ rtl = (*targetm.delegitimize_address) (rtl);
+
+ indirect_p = 1;
+ ret = mem_loc_descriptor (rtl, mode);
+ break;
+ }
+
case TRUTH_AND_EXPR:
case TRUTH_ANDIF_EXPR:
case BIT_AND_EXPR:
static void
add_data_member_location_attribute (dw_die_ref die, tree decl)
{
- long offset;
+ HOST_WIDE_INT offset;
dw_loc_descr_ref loc_descr = 0;
if (TREE_CODE (decl) == TREE_VEC)
{
HOST_WIDE_INT val = INTVAL (rtl);
- /* ??? We really should be using HOST_WIDE_INT throughout. */
- if (val < 0 && (long) val == val)
- add_AT_int (die, DW_AT_const_value, (long) val);
- else if ((unsigned long) val == (unsigned HOST_WIDE_INT) val)
- add_AT_unsigned (die, DW_AT_const_value, (unsigned long) val);
- else
- {
-#if HOST_BITS_PER_LONG * 2 == HOST_BITS_PER_WIDE_INT
- add_AT_long_long (die, DW_AT_const_value,
- val >> HOST_BITS_PER_LONG, val);
-#else
- abort ();
-#endif
- }
+ if (val < 0)
+ add_AT_int (die, DW_AT_const_value, val);
+ else
+ add_AT_unsigned (die, DW_AT_const_value, (unsigned HOST_WIDE_INT) val);
}
break;
if (GET_MODE_CLASS (mode) == MODE_FLOAT)
{
unsigned length = GET_MODE_SIZE (mode) / 4;
- long *array = (long *) ggc_alloc (sizeof (long) * length);
+ long *array = ggc_alloc (sizeof (long) * length);
REAL_VALUE_TYPE rv;
REAL_VALUE_FROM_CONST_DOUBLE (rv, rtl);
- switch (mode)
- {
- case SFmode:
- REAL_VALUE_TO_TARGET_SINGLE (rv, array[0]);
- break;
-
- case DFmode:
- REAL_VALUE_TO_TARGET_DOUBLE (rv, array);
- break;
-
- case XFmode:
- case TFmode:
- REAL_VALUE_TO_TARGET_LONG_DOUBLE (rv, array);
- break;
-
- default:
- abort ();
- }
+ real_to_target (array, &rv, mode);
add_AT_float (die, DW_AT_const_value, length, array);
}
static void
add_comp_dir_attribute (dw_die_ref die)
{
- const char *wd = getpwd ();
+ const char *wd = get_src_pwd ();
if (wd != NULL)
add_AT_string (die, DW_AT_comp_dir, wd);
}
lower = TYPE_MIN_VALUE (domain);
upper = TYPE_MAX_VALUE (domain);
- /* define the index type. */
+ /* Define the index type. */
if (TREE_TYPE (domain))
{
/* ??? This is probably an Ada unnamed subrange type. Ignore the
add_name_attribute (enum_die,
IDENTIFIER_POINTER (TREE_PURPOSE (link)));
- if (host_integerp (TREE_VALUE (link), 0))
+ if (host_integerp (TREE_VALUE (link),
+ TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (link)))))
{
if (tree_int_cst_sgn (TREE_VALUE (link)) < 0)
add_AT_int (enum_die, DW_AT_const_value,
tree_low_cst (TREE_VALUE (link), 0));
else
add_AT_unsigned (enum_die, DW_AT_const_value,
- tree_low_cst (TREE_VALUE (link), 0));
+ tree_low_cst (TREE_VALUE (link), 1));
}
}
}
decl = DECL_ORIGIN (decl);
old_die = lookup_decl_die (decl);
- if (old_die && get_AT_unsigned (old_die, DW_AT_inline))
+ if (old_die && get_AT (old_die, DW_AT_inline))
/* We've already generated the abstract instance. */
return;
/* We can have a normal definition following an inline one in the
case of redefinition of GNU C extern inlines.
It seems reasonable to use AT_specification in this case. */
- && !get_AT_unsigned (old_die, DW_AT_inline))
+ && !get_AT (old_die, DW_AT_inline))
{
/* ??? This can happen if there is a bug in the program, for
instance, if it has duplicate function definitions. Ideally,
if (declaration)
{
- if (!old_die || !get_AT_unsigned (old_die, DW_AT_inline))
+ if (!old_die || !get_AT (old_die, DW_AT_inline))
{
add_AT_flag (subr_die, DW_AT_declaration, 1);
}
else if (DECL_ABSTRACT (decl))
{
- if (DECL_INLINE (decl) && !flag_no_inline)
+ if (DECL_DECLARED_INLINE_P (decl))
{
- /* ??? Checking DECL_DEFER_OUTPUT is correct for static
- inline functions, but not for extern inline functions.
- We can't get this completely correct because information
- about whether the function was declared inline is not
- saved anywhere. */
- if (DECL_DEFER_OUTPUT (decl))
+ if (cgraph_function_possibly_inlined_p (decl))
add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_inlined);
else
- add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_inlined);
+ add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_not_inlined);
}
else
- add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_not_inlined);
+ {
+ if (cgraph_function_possibly_inlined_p (decl))
+ add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_inlined);
+ else
+ add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_not_inlined);
+ }
equate_decl_number_to_die (decl, subr_die);
}
else if (!DECL_EXTERNAL (decl))
{
- if (!old_die || !get_AT_unsigned (old_die, DW_AT_inline))
+ if (!old_die || !get_AT (old_die, DW_AT_inline))
equate_decl_number_to_die (decl, subr_die);
ASM_GENERATE_INTERNAL_LABEL (label_id, FUNC_BEGIN_LABEL,
fn_arg_types = TYPE_ARG_TYPES (TREE_TYPE (decl));
if (fn_arg_types != NULL)
{
- /* this is the prototyped case, check for ... */
+ /* This is the prototyped case, check for.... */
if (TREE_VALUE (tree_last (fn_arg_types)) != void_type_node)
gen_unspecified_parameters_die (decl, subr_die);
}
static void
gen_inlined_subroutine_die (tree stmt, dw_die_ref context_die, int depth)
{
+ tree decl = block_ultimate_origin (stmt);
+
+ /* Emit info for the abstract instance first, if we haven't yet. We
+ must emit this even if the block is abstract, otherwise when we
+ emit the block below (or elsewhere), we may end up trying to emit
+ a die whose origin die hasn't been emitted, and crashing. */
+ dwarf2out_abstract_function (decl);
+
if (! BLOCK_ABSTRACT (stmt))
{
dw_die_ref subr_die
= new_die (DW_TAG_inlined_subroutine, context_die, stmt);
- tree decl = block_ultimate_origin (stmt);
char label[MAX_ARTIFICIAL_LABEL_BYTES];
- /* Emit info for the abstract instance first, if we haven't yet. */
- dwarf2out_abstract_function (decl);
-
add_abstract_origin_attribute (subr_die, decl);
ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL,
BLOCK_NUMBER (stmt));
/* If we're emitting an out-of-line copy of an inline function,
emit info for the abstract instance and set up to refer to it. */
- else if (DECL_INLINE (decl) && ! DECL_ABSTRACT (decl)
+ else if (cgraph_function_possibly_inlined_p (decl)
+ && ! DECL_ABSTRACT (decl)
&& ! class_scope_p (context_die)
/* dwarf2out_abstract_function won't emit a die if this is just
a declaration. We must avoid setting DECL_ABSTRACT_ORIGIN in
{
separate_line_info_table_allocated += LINE_INFO_TABLE_INCREMENT;
separate_line_info_table
- = (dw_separate_line_info_ref)
- ggc_realloc (separate_line_info_table,
+ = ggc_realloc (separate_line_info_table,
separate_line_info_table_allocated
* sizeof (dw_separate_line_info_entry));
- memset ((separate_line_info_table
- + separate_line_info_table_in_use),
+ memset (separate_line_info_table
+ + separate_line_info_table_in_use,
0,
(LINE_INFO_TABLE_INCREMENT
* sizeof (dw_separate_line_info_entry)));
static void
dwarf2out_start_source_file (unsigned int lineno, const char *filename)
{
- if (flag_eliminate_dwarf2_dups && !is_main_source)
+ if (flag_eliminate_dwarf2_dups)
{
/* Record the beginning of the file for break_out_includes. */
dw_die_ref bincl_die;
add_AT_string (bincl_die, DW_AT_name, filename);
}
- is_main_source = 0;
-
if (debug_info_level >= DINFO_LEVEL_VERBOSE)
{
named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
invoked when the given (base) source file was compiled. We will fill
in this value in dwarf2out_finish. */
comp_unit_die = gen_compile_unit_die (NULL);
- is_main_source = 1;
VARRAY_TREE_INIT (incomplete_types, 64, "incomplete_types");