diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1999-10-31 20:11:22 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1999-10-31 20:11:22 -0500 |
commit | 14a774a9d22db91fb6387cb8eb61060b61782f29 (patch) | |
tree | 58ab23a2ebe35102f1a66447caaf4626bb2b4641 /gcc/dwarf2out.c | |
parent | 8f65050e4185eaed8aa074387c3db51955ac806b (diff) | |
download | gcc-14a774a9d22db91fb6387cb8eb61060b61782f29.zip gcc-14a774a9d22db91fb6387cb8eb61060b61782f29.tar.gz gcc-14a774a9d22db91fb6387cb8eb61060b61782f29.tar.bz2 |
[multiple changes]
Fri Oct 29 15:25:07 1999 Arnaud Charlet <charlet@ACT-Europe.FR>
* gcov.c (DIR_SEPARATOR): Provide default.
(output_data): Add test for MS-DOS format absolute filename.
(fancy_abort): Correct program name.
(open_files): Open all files in binary mode.
* libgcc2.c (__bb_exit_func): Likewise.
* profile.c (init_branch_prob): Specify binary when opening files.
* flags.h (flag_unwind_tables): New decl.
* toplev.c (flag_unwind_table): New definition.
(f_options): Add -funwind-tables.
(decode_g_option): Clarify warning when unknown -g option is given.
(rest_of_compilation): If inside an inlined external function,
pretend we are just being declared.
* dwarf2out.c (dwarf2out_do_frame): Check -funwind_tables.
(dwarf2out_frame_finish): Likewise.
Fri Oct 29 06:32:44 1999 Geoffrey Keating <geoffk@cygnus.com>
* flow.c (propagate_block): When the last reference to a label
before an ADDR_VEC is deleted because the reference is a dead
store, delete the ADDR_VEC.
Fri Oct 29 07:44:26 1999 Vasco Pedro <vp@di.fct.unl.pt>
* fold-const.c (merge_ranges): In not in0, but in1, handle
upper bounds equal like subset case.
Thu Oct 28 19:22:24 1999 Douglas Rupp <rupp@gnat.com>
* dbxout.c (dbxout_parms): Generate a second stabs line for parameters
passed in a register but moved to the stack.
Thu Oct 28 19:12:57 1999 Sam Tardieu <tardieu@act-europe.fr>
* gcc.c (pass_exit_codes, greatest_status): New variables.
(struct option_map): Add entry for "--pass-exit-codes".
(execute): Update greatest_status if error.
(display_help): Add documentation for -pass-exit-codes.
(process_command): Handle -pass-exit-codes.
(main): Look at pass_exit_codes and greatest_status on call to exit.
Thu Oct 28 18:06:50 1999 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* reload.c (find_reloads): Refine test for no input reload
case to not includes reloads emitted after insn.
* function.c (find_temp_slots_from_address): Handle sum involving
a register that points to a temp slot.
(update_temp_slot_address): Make recursive call if both old and
new are PLUS with a common operand.
* calls.c (expand_call): Mark temp slot for result as having
address taken.
* rtlanal.c (reg_referenced_p, case IF_THEN_ELSE): New case.
* gcc.c (process_command): Add standard_exec_prefix with "GCC"
component as well as "BINUTILS".
* integrate.h (copy_rtx_and_substitute): New arg, FOR_LHS.
* integrate.c (copy_rtx_and_substitute): Likewise.
(expand_inline_function, integrate_parm_decls, integrate_decl_tree):
All callers changed.
* unroll.c (inital_reg_note_copy, copy_loop_body): Likewise.
* dbxout.c (dbxout_type, case INTEGER_TYPE_NODE): If can use
gdb extensions, write size of type; also be more consistent
in using references when this is a subtype.
* pa.md (extv, extzv, insv): Use define_expand to reject constant
that is out of range.
* loop.c (unknown_constant_address_altered): New variable.
(prescan_loop): Initialize it.
(note_addr_stored): Set it for RTX_UNCHANGING_P MEM.
(invariant_p, case MEM): Remove handling for volatile and readony;
check new variable if readonly.
(check_dbra_loop): Chdeck unknown_constant_address_altered.
* cse.c (canon_hash, case MEM): Do not record if BLKmode.
(addr_affects_sp_p): Removed from note_mem_written and only
define #ifdef AUTO_INC_DEC.
* alpha.c (input_operand, case ADDRESSOF): Treat as REG.
* regclass.c (record_reg_classes): Properly handle register move
directions.
* varasm.c (initializer_constant_valid_p, case MINUS_EXPR):
Don't think valid if both operands are invalid.
(struct constant_descriptor): New field RTL.
(mark_const_hash_entry): Mark it.
(record_constant{,_rtx}): Initialize it.
(output_constant_def): Allocate RTL in permanent obstack and
save in table.
({record,compare}_constant_1): Modes must match for
CONSTRUCTOR of ARRAY_TYPE.
* c-common.h (initializer_constant_valid_p): Delete decl from here.
* output.h (initializer_constant_valid_p): Move decl to here.
* c-common.c (initializer_constant_valid_p): Delete function from here.
* varasm.c (initializer_constant_valid_p): Move function to here.
* tree.h (STRIP_SIGN_NOPS): New macro.
* fold-const.c (optimize_minmax_comparison): New function.
(invert_truthvalue, case WITH_RECORD_EXPR): New case.
(fold): Use STRIP_SIGN_NOPS instead of STRIP_TYPE_NOPS.
(fold, case EQ_EXPR): Call optimize_minmax_comparison and add
cases with ABS_EXPR, NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR, and
widening conversions.
(fold, case LE_EXPR): Rework changing unsigned to signed comparisons
to look at size of mode, not precision of type; also add missing cases.
(optimize_bit_field_compare, decode_field_reference): Don't try to
optimize COMPONENT_REF of a PLACEHOLDER_EXPR.
* dwarf2out.c (ctype.h): Include.
(dwarf2out_set_demangle_name_func): New function.
(size_of_line_info): Deleted.
(output_line_info): Compute size of line info table from difference
of labels.
(base_type_die, add_name_attribute): Call demangle function, if any.
(field_byte_offset): Use bits per word for variable length fields.
(gen_array_type_die): Add array name.
(gen_subprogram_die): Ignore DECL_INLINE if -fno-inline.
(dwarf2out_add_library_unit_info): New function.
* explow.c (set_stack_check_libfunc): New function.
(stack_check_libfunc): New static variable.
(probe_stack_range): Allow front-end to set up a libfunc to call.
* combine.c (simplify_comparison): When making comparison in wider
mode, check for having commuted an AND and a SUBREG.
(contains_muldiv): New function.
(try_combine): Call it when dividing a PARALLEL.
(simplify_rtx, case TRUNCATE): Don't remove for umulsi3_highpart.
(simplify_comparison, case ASHIFTRT): Recognize sign-extension of
a PLUS.
(record_value_for_reg): If TEM is a binary operation with two CLOBBERs,
use one of the CLOBBERs instead.
(if_then_else_cond): If comparing against zero, just return thing
being compared.
* optabs.c (expand_abs): If machine has MAX, ABS (x) is MAX (x, -x).
Don't generate shifts and subtract if have conditional arithmetic.
* rtl.h (delete_barrier): New declaration.
* jump.c (jump_optimize): Set up to handle conditional call.
In conditional arithmetic case, handle CALL_INSN followed by a BARRIER.
(delete_barrier): New function.
* rtl.c (read_rtx): Call fatal if bad RTL code; check for bad mode.
* recog.c (nonmemory_operand): Accept ADDRESSOF.
* tree.c (build_type_attribute_variant): Push to obstack of
ttype around type_hash_canon call.
* expr.c (placeholder_list): Move decl to file scope.
(expand_expr): Don't force access to volatile just because its
address is taken.
If ignoring reference operations, just expand the operands.
(expand_expr, case COMPONENT_REF): Propagate
EXPAND_CONST_ADDRESS to recursive call when expanding inner.
Refine test for using bitfield operations vs pointer punning.
(expand_expr, case CONVERT_EXPR): If converting to
BLKmode UNION_TYPE from BLKmode, just return inner object.
Use proper mode in store_field call.
Properly set sizes of object to store and total size in store_field
call for convert to union.
(expand_expr, case ARRAY_REF): If OP0 is in a register, put it in
memory (like for ADDR_EXPR). Also, don't put constant in register if
we'll want it in memory.
(readonly_fields_p): New function.
(expand_expr, case INDIRECT_REF): Call it if LHS.
(expand_assignment): Handle a RESULT_DECL where
DECL_RTL is a PARALLEL.
(do_jump, case WITH_RECORD_EXPR): New case.
(get_inner_reference): Always go inside a CONVERT_EXPR
and NOP_EXPR if both modes are the same.
(store_field): Use bitfield operations if size of bitsize is not same
as size of RHS's type.
Check for bitpos not a multiple of alignment in BLKmode case.
Do block move in largest possible alignment.
(store_constructor): Set BITSIZE to -1 for variable size and properly
in case of array of BLKmode.
(expand_expr_unaligned): New function.
(do_compare_and_jump): Call it.
* mips/iris5.h (SWITCHES_NEED_SPACES): New macro.
* collect2.c (main): Only allow -ofoo if SWITCHES_NEED_SPACES
does not include 'o'.
* function.c (instantiate_virtual_regs_1, case SET): Handle case where
both SET_DEST and SET_SRC reference a virtual register.
(gen_mem_addressof): Copy RTX_UNCHANGING_P from new REG to old REG.
* integrate.c (expand_inline_function): Handle case of setting
virtual stack vars register (from built in setjmp); when parameter
lives in memory, expand virtual_{stack_vars,incoming_args}_rtx early.
(subst_constant): Add new parm, MEMONLY.
(expand_inline_function, integrate_parm_decls): Pass new parm.
(integrate_decl_tree): Likewise.
(copy_rtx_and_substitute, case MEM): Do copy RTX_UNCHANGING_P.
(try_constants): Call subst_constants twice, with MEMONLY 0 and 1.
(copy_rtx_and_substitute, case SET): Add explicit calls to
copy_rtx_and_substitute for both sides.
* stmt.c (expand_asm_operands): Don't use TREE_STRING_LENGTH for
constraints.
(pushcase{,_range}): Convert to NOMINAL_TYPE after checking for
within INDEX_TYPE, instead of before.
(fixup_gotos): Use f->target_rtl, not the next insn,
since latter may be from a later fixup.
(expand_value_return): Correctly convert VAL when promoting function
return; support RETURN_REG being a PARALLEL.
(expand_return): When checking for result in regs and having
cleanup, consider PARALLEL in DECL_RTL as being in regs.
From-SVN: r30299
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 237 |
1 files changed, 63 insertions, 174 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index a9ee93c..08b957d 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -44,6 +44,7 @@ Boston, MA 02111-1307, USA. */ #include "dwarf2out.h" #include "toplev.h" #include "dyn-string.h" +#include <ctype.h> /* We cannot use <assert.h> in GCC source, since that would include GCC's assert.h, which may not be compatible with the host compiler. */ @@ -65,6 +66,7 @@ dwarf2out_do_frame () || DWARF2_FRAME_INFO #endif #ifdef DWARF2_UNWIND_INFO + || flag_unwind_tables || (flag_exceptions && ! exceptions_via_longjmp) #endif ); @@ -1904,11 +1906,11 @@ dwarf2out_frame_finish () #ifdef MIPS_DEBUGGING_INFO if (write_symbols == DWARF2_DEBUG) output_call_frame_info (0); - if (flag_exceptions && ! exceptions_via_longjmp) + if (flag_unwind_tables || (flag_exceptions && ! exceptions_via_longjmp)) output_call_frame_info (1); #else if (write_symbols == DWARF2_DEBUG - || (flag_exceptions && ! exceptions_via_longjmp)) + || flag_unwind_tables || (flag_exceptions && ! exceptions_via_longjmp)) output_call_frame_info (1); #endif } @@ -2441,7 +2443,6 @@ static int constant_size PROTO((long unsigned)); static unsigned long size_of_die PROTO((dw_die_ref)); static void calc_die_sizes PROTO((dw_die_ref)); static unsigned long size_of_line_prolog PROTO((void)); -static unsigned long size_of_line_info PROTO((void)); static unsigned long size_of_pubnames PROTO((void)); static unsigned long size_of_aranges PROTO((void)); static enum dwarf_form value_format PROTO((dw_val_ref)); @@ -2655,6 +2656,18 @@ static char debug_line_section_label[MAX_ARTIFICIAL_LABEL_BYTES]; while (0) #endif +/* We allow a language front-end to designate a function that is to be + called to "demangle" any name before it it put into a DIE. */ + +static char *(*demangle_name_func) PROTO((char *)); + +void +dwarf2out_set_demangle_name_func (func) + char *(*func) PROTO((char *)); +{ + demangle_name_func = func; +} + /* Convert an integer constant expression into assembler syntax. Addition and subtraction are the only arithmetic that may appear in these expressions. This is an adaptation of output_addr_const in final.c. @@ -4720,165 +4733,6 @@ size_of_line_prolog () return size; } -/* Return the size of the line information generated for this - compilation unit. */ - -static unsigned long -size_of_line_info () -{ - register unsigned long size; - register unsigned long lt_index; - register unsigned long current_line; - register long line_offset; - register long line_delta; - register unsigned long current_file; - register unsigned long function; - unsigned long size_of_set_address; - - /* Size of a DW_LNE_set_address instruction. */ - size_of_set_address = 1 + size_of_uleb128 (1 + PTR_SIZE) + 1 + PTR_SIZE; - - /* Version number. */ - size = 2; - - /* Prolog length specifier. */ - size += DWARF_OFFSET_SIZE; - - /* Prolog. */ - size += size_of_line_prolog (); - - current_file = 1; - current_line = 1; - for (lt_index = 1; lt_index < line_info_table_in_use; ++lt_index) - { - register dw_line_info_ref line_info = &line_info_table[lt_index]; - - if (line_info->dw_line_num == current_line - && line_info->dw_file_num == current_file) - continue; - - /* Advance pc instruction. */ - /* ??? See the DW_LNS_advance_pc comment in output_line_info. */ - if (0) - size += 1 + 2; - else - size += size_of_set_address; - - if (line_info->dw_file_num != current_file) - { - /* Set file number instruction. */ - size += 1; - current_file = line_info->dw_file_num; - size += size_of_uleb128 (current_file); - } - - if (line_info->dw_line_num != current_line) - { - line_offset = line_info->dw_line_num - current_line; - line_delta = line_offset - DWARF_LINE_BASE; - current_line = line_info->dw_line_num; - if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1)) - /* 1-byte special line number instruction. */ - size += 1; - else - { - /* Advance line instruction. */ - size += 1; - size += size_of_sleb128 (line_offset); - /* Generate line entry instruction. */ - size += 1; - } - } - } - - /* Advance pc instruction. */ - if (0) - size += 1 + 2; - else - size += size_of_set_address; - - /* End of line number info. marker. */ - size += 1 + size_of_uleb128 (1) + 1; - - function = 0; - current_file = 1; - current_line = 1; - for (lt_index = 0; lt_index < separate_line_info_table_in_use; ) - { - register dw_separate_line_info_ref line_info - = &separate_line_info_table[lt_index]; - - if (line_info->dw_line_num == current_line - && line_info->dw_file_num == current_file - && line_info->function == function) - goto cont; - - if (function != line_info->function) - { - function = line_info->function; - /* Set address register instruction. */ - size += size_of_set_address; - } - else - { - /* Advance pc instruction. */ - if (0) - size += 1 + 2; - else - size += size_of_set_address; - } - - if (line_info->dw_file_num != current_file) - { - /* Set file number instruction. */ - size += 1; - current_file = line_info->dw_file_num; - size += size_of_uleb128 (current_file); - } - - if (line_info->dw_line_num != current_line) - { - line_offset = line_info->dw_line_num - current_line; - line_delta = line_offset - DWARF_LINE_BASE; - current_line = line_info->dw_line_num; - if (line_delta >= 0 && line_delta < (DWARF_LINE_RANGE - 1)) - /* 1-byte special line number instruction. */ - size += 1; - else - { - /* Advance line instruction. */ - size += 1; - size += size_of_sleb128 (line_offset); - - /* Generate line entry instruction. */ - size += 1; - } - } - - cont: - ++lt_index; - - /* If we're done with a function, end its sequence. */ - if (lt_index == separate_line_info_table_in_use - || separate_line_info_table[lt_index].function != function) - { - current_file = 1; - current_line = 1; - - /* Advance pc instruction. */ - if (0) - size += 1 + 2; - else - size += size_of_set_address; - - /* End of line number info. marker. */ - size += 1 + size_of_uleb128 (1) + 1; - } - } - - return size; -} - /* Return the size of the .debug_pubnames table generated for the compilation unit. */ @@ -5650,10 +5504,7 @@ output_aranges () } /* Output the source line number correspondence information. This - information goes into the .debug_line section. - - If the format of this data changes, then the function size_of_line_info - must also be adjusted the same way. */ + information goes into the .debug_line section. */ static void output_line_info () @@ -5670,12 +5521,13 @@ output_line_info () register unsigned long current_file; register unsigned long function; - ASM_OUTPUT_DWARF_DATA (asm_out_file, size_of_line_info ()); + ASM_OUTPUT_DWARF_DELTA (asm_out_file, ".LTEND", ".LTSTART"); if (flag_debug_asm) fprintf (asm_out_file, "\t%s Length of Source Line Info.", ASM_COMMENT_START); fputc ('\n', asm_out_file); + ASM_OUTPUT_LABEL (asm_out_file, ".LTSTART"); ASM_OUTPUT_DWARF_DATA2 (asm_out_file, DWARF_VERSION); if (flag_debug_asm) fprintf (asm_out_file, "\t%s DWARF Version", ASM_COMMENT_START); @@ -5932,6 +5784,7 @@ output_line_info () } /* Output the marker for the end of the line number info. */ + ASM_OUTPUT_LABEL (asm_out_file, ".LTEND"); ASM_OUTPUT_DWARF_DATA1 (asm_out_file, 0); if (flag_debug_asm) fprintf (asm_out_file, "\t%s DW_LNE_end_sequence", ASM_COMMENT_START); @@ -6234,6 +6087,9 @@ base_type_die (type) } base_type_result = new_die (DW_TAG_base_type, comp_unit_die); + if (demangle_name_func) + type_name = (*demangle_name_func) (type_name); + add_AT_string (base_type_result, DW_AT_name, type_name); add_AT_unsigned (base_type_result, DW_AT_byte_size, int_size_in_bytes (type)); @@ -6774,17 +6630,20 @@ field_byte_offset (decl) bitpos_tree = DECL_FIELD_BITPOS (decl); field_size_tree = DECL_SIZE (decl); - /* We cannot yet cope with fields whose positions or sizes are variable, so + /* We cannot yet cope with fields whose positions are variable, so for now, when we see such things, we simply return 0. Someday, we may be able to handle such cases, but it will be damn difficult. */ if (TREE_CODE (bitpos_tree) != INTEGER_CST) return 0; + bitpos_int = (unsigned) TREE_INT_CST_LOW (bitpos_tree); - if (TREE_CODE (field_size_tree) != INTEGER_CST) - return 0; + /* If we don't know the size of the field, pretend it's a full word. */ + if (TREE_CODE (field_size_tree) == INTEGER_CST) + field_size_in_bits = (unsigned) TREE_INT_CST_LOW (field_size_tree); + else + field_size_in_bits = BITS_PER_WORD; - field_size_in_bits = (unsigned) TREE_INT_CST_LOW (field_size_tree); type_size_in_bits = simple_type_size_in_bits (type); type_align_in_bits = simple_type_align_in_bits (type); type_align_in_bytes = type_align_in_bits / BITS_PER_UNIT; @@ -7229,7 +7088,12 @@ add_name_attribute (die, name_string) register const char *name_string; { if (name_string != NULL && *name_string != 0) - add_AT_string (die, DW_AT_name, name_string); + { + if (demangle_name_func) + name_string = (*demangle_name_func) (name_string); + + add_AT_string (die, DW_AT_name, name_string); + } } /* Given a tree node describing an array bound (either lower or upper) output @@ -7923,6 +7787,7 @@ gen_array_type_die (type, context_die) #endif add_subscript_info (array_die, type); + add_name_attribute (array_die, type_tag (type)); equate_type_number_to_die (type, array_die); /* Add representation of the type of the elements of this array type. */ @@ -8422,13 +8287,13 @@ gen_subprogram_die (decl, context_die) inline is not saved anywhere. */ if (DECL_DEFER_OUTPUT (decl)) { - if (DECL_INLINE (decl)) + if (DECL_INLINE (decl) && !flag_no_inline) add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_inlined); else add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_declared_not_inlined); } - else if (DECL_INLINE (decl)) + else if (DECL_INLINE (decl) && !flag_no_inline) add_AT_unsigned (subr_die, DW_AT_inline, DW_INL_inlined); else abort (); @@ -9577,6 +9442,30 @@ gen_decl_die (decl, context_die) } } +/* Add Ada "use" clause information for SGI Workshop debugger. */ + +void +dwarf2out_add_library_unit_info (filename, context_list) + char *filename; + char *context_list; +{ + unsigned int file_index; + + if (filename != NULL) + { + dw_die_ref unit_die = new_die (DW_TAG_module, comp_unit_die); + tree context_list_decl + = build_decl (LABEL_DECL, get_identifier (context_list), + void_type_node); + + TREE_PUBLIC (context_list_decl) = TRUE; + add_name_attribute (unit_die, context_list); + file_index = lookup_filename (filename); + add_AT_unsigned (unit_die, DW_AT_decl_file, file_index); + add_pubname (context_list_decl, unit_die); + } +} + /* Write the debugging output for DECL. */ void |