aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
AgeCommit message (Collapse)AuthorFilesLines
2018-05-15DWARF: Use DW_OP_addrx and DW_OP_constx for DWARF5.Mark Wielaard1-4/+29
For older DWARF and -gsplit-dwarf we want to emit DW_OP_GNU_addr_index and DW_OP_GNU_const_index, but for DWARF5 we should use DW_OP_addrx and DW_OP_constx. gcc/ChangeLog: * dwarf2out.c (dwarf_OP): Handle DW_OP_addrx and DW_OP_constx. (size_of_loc_descr): Likewise. (output_loc_operands): Likewise. (output_loc_operands_raw): Likewise. (dw_addr_op): Use dwarf_OP () for DW_OP_constx and DW_OP_addrx. (resolve_addr_in_expr): Handle DW_OP_addrx and DW_OP_constx. (hash_loc_operands): Likewise. (compare_loc_operands): Likewise. From-SVN: r260252
2018-05-15DWARF calculate the number of indexed addresses.Mark Wielaard1-2/+19
The length in the .debug_addr unit header was calculated using the number of elements in the addr_index_table. This is wrong because the entries in the table are refcounted and only those with a refcount > 0 are actually put in the index. Add a helper function count_index_addrs to get the correct number of addresses in the index. gcc/ChangeLog: * dwarf2out.c (count_index_addrs): New function. (dwarf2out_finish): Use count_index_addrs to calculate addrs_length. From-SVN: r260251
2018-04-30re PR bootstrap/85571 (non-bootstrap-debug miscompare with trunk)Richard Biener1-0/+2
2018-04-30 Richard Biener <rguenther@suse.de> PR bootstrap/85571 * Makefile.tpl (STAGE3_CFLAGS): Use -fchecking=1. (STAGE3_TFLAGS): Likewise. (STAGEtrain_CFLAGS): Filter out -fchecking=1. (STAGEtrain_TFLAGS): Likewise. * Makefile.in: Regenerate. * dwarf2out.c (gen_producer_string): Ignore -fchecking[=]. From-SVN: r259755
2018-04-28DWARF: Add .debug_addr table header for dwarf_version >= 5.Mark Wielaard1-1/+24
GNU DebugFission didn't add table headers for the .debug_addr tables, but DWARF5 does. The table header makes it possible for a DWARF consumer to parse the address tables without having to index all .debug_info CUs first. We can keep using the .debug_addr section label as is, because the DW_AT_[GNU_]addr_base attribute points at the actual address index, which starts right after the table header. So the label is generated at the correct location whether the header is added first or not. Add DW_AT_addr_base instead of DW_AT_GNU_addr_base to the skeleton CU DIE for DWARF5. gcc/ChangeLog * dwarf2out.c (dwarf2out_finish): Add .debug_addr table header for dwarf_version >= 5. (dwarf_AT): Handle DW_AT_addr_base. (add_top_level_skeleton_die_attrs): Use dwarf_AT for DW_AT_addr_base. From-SVN: r259743
2018-04-25DWARF sort longer dirs before shorter ones in directory table.Mark Wielaard1-4/+7
When gcc dwarf2out generates the .debug_line table itself (for example when generating one for a split DWARF .dwo) it uses natural sorting for the directory table. Shorter directory paths come before longer directory paths with the same prefix. This causes the files in the line table to pick the shorter dir. Creating slightly ineffecient line tables because the longer directory paths will never be used. Fix this by changing file_info_cmp () to pick longer directory prefixes before shorter ones. We still sort files (the compilation unit) without any directory path before all entries with a directory path, so they will still use dir entry 0 (the working directory). A hello.c program would get the following dir and line table before: Directory table: /opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/8.0.1/include /usr/include /usr/include/bits File name table: Entry Dir Time Size Name 1 0 0 0 hello.c 2 1 0 0 stddef.h 3 2 0 0 bits/types.h 4 2 0 0 libio.h 5 2 0 0 stdio.h 6 2 0 0 bits/sys_errlist.h Note that the last directory table entry is never used. After this patch it looks as follows: Directory table: /opt/local/install/gcc/lib/gcc/x86_64-pc-linux-gnu/8.0.1/include /usr/include/bits /usr/include File name table: Entry Dir Time Size Name 1 0 0 0 hello.c 2 1 0 0 stddef.h 3 2 0 0 types.h 4 3 0 0 libio.h 5 3 0 0 stdio.h 6 2 0 0 sys_errlist.h Which is similar to what gas would output. gcc/ChangeLog: * dwarf2out.c (file_info_cmp): Sort longer dir prefixes before shorter ones. From-SVN: r259655
2018-04-12re PR target/85238 (lto-wrapper: fatal error: ↵Eric Botcazou1-1/+5
simple_object_copy_lto_debug_sections not implemented: Invalid argument on Cygwin) PR target/85238 * lto-wrapper.c (debug_objcopy): Open the files in binary mode. * dwarf2out.c (dwarf2out_early_finish): Do not generate assembly in LTO mode for PE-COFF targets. * config/i386/i386-protos.h (i386_pe_asm_lto_start): Declare. (i386_pe_asm_lto_end): Likewise. * config/i386/cygming.h (TARGET_ASM_LTO_START): Define. (TARGET_ASM_LTO_END): Likewise. * config/i386/winnt.c (saved_debug_info_level): New static variable. (i386_pe_asm_lto_start): New function. (i386_pe_asm_lto_end): Likewise. From-SVN: r259347
2018-04-12re PR lto/85371 (Compiling code with -g -flto gives an ICE on darwin after ↵Richard Biener1-12/+11
revision r259317) 2018-04-12 Richard Biener <rguenther@suse.de> PR lto/85371 * dwarf2out.c (init_sections_and_labels): Use debug_line_section[_label] for the early LTO debug to properly generate references to it during DIE emission. Do not re-use that for the skeleton for split-dwarf. (dwarf2out_early_finish): Likewise. From-SVN: r259345
2018-04-11re PR lto/85339 (With early LTO debug the early DWARF misses line-info)Richard Biener1-6/+16
2018-04-11 Richard Biener <rguenther@suse.de> PR lto/85339 * dwarf2out.c (dwarf2out_finish): Remove DW_AT_stmt_list attribute from early DWARF output. (dwarf2out_early_finish): Output line info unconditionally into early DWARF and add reference to it. From-SVN: r259317
2018-04-11re PR rtl-optimization/85302 (ICE in size_of_loc_descr, at dwarf2out.c:1771 ↵Jakub Jelinek1-6/+18
on i686-linux-gnu) PR debug/85302 * dwarf2out.c (skip_loc_list_entry): Don't call size_of_locs if SIZEP is NULL. (output_loc_list): Pass address of a dummy size variable even in the locview handling loop. (index_location_lists): Add comment on why skip_loc_list_entry can't call size_of_locs. * g++.dg/debug/dwarf2/pr85302.C: New test. From-SVN: r259311
2018-04-06re PR debug/85252 (ICE with -g for static zero-length array initialization)Jakub Jelinek1-0/+2
PR debug/85252 * dwarf2out.c (rtl_for_decl_init): For STRING_CST initializer only build CONST_STRING if TYPE_MAX_VALUE is non-NULL and is INTEGER_CST. * gcc.dg/debug/pr85252.c: New test. From-SVN: r259183
2018-04-04re PR debug/85176 (ICE in force_decl_die, at dwarf2out.c:25910)Richard Biener1-0/+5
2018-04-04 Richard Biener <rguenther@suse.de> PR lto/85176 * dwarf2out.c (dwarf2out_register_external_die): Peel namespaces from contexts for DINFO_LEVEL_TERSE and below. * g++.dg/lto/pr85176_0.C: New testcase. From-SVN: r259080
2018-03-23re PR bootstrap/85020 (gcc fails to bootstrap with profiledbootstrap and ↵Richard Biener1-0/+1
--with-build-config=bootstrap-lto) 2018-03-23 Richard Biener <rguenther@suse.de> PR debug/85020 * dwarf2out.c (rtl_for_decl_location): Do not generate RTL early when we are going to emit early debug for LTO. From-SVN: r258798
2018-03-11re PR debug/58150 (debug info about definition of enum class not emitted if ↵Jakub Jelinek1-15/+22
the declaration was already used in a class) PR debug/58150 * dwarf2out.c (gen_enumeration_type_die): Don't guard adding DW_AT_declaration for ENUM_IS_OPAQUE on -gdwarf-4 or -gno-strict-dwarf, but on TYPE_SIZE. Don't do anything for ENUM_IS_OPAQUE if not creating a new die. Don't set TREE_ASM_WRITTEN if ENUM_IS_OPAQUE. Guard addition of most attributes on !orig_type_die or the attribute not being present already. Assert TYPE_VALUES is NULL for ENUM_IS_OPAQUE. * g++.dg/debug/dwarf2/enum2.C: New test. From-SVN: r258434
2018-03-10[IEPM] [PR debug/84620] use constant form for DW_AT_GNU_entry_viewAlexandre Oliva1-6/+96
When outputting entry views in symbolic mode, we used to use a lbl_id, but that outputs the view as an addr, perhaps even in an indirect one, which is all excessive and undesirable for a small assembler-computed constant. Introduce a new value class for symbolic views, so that we can output the labels as constant data, using as narrow forms as possible, but wide enough for any symbolic views output in the compilation. We don't know exactly where the assembler will reset views, but we count the symbolic views since known reset points and use that as an upper bound for view numbers. Ideally, we'd use uleb128, but then the compiler would have to defer .debug_info offset computation to the assembler. I'm not going there for now, so a symbolic uleb128 assembler constant in an attribute is not something GCC can deal with ATM. for gcc/ChangeLog PR debug/84620 * dwarf2out.h (dw_val_class): Add dw_val_class_symview. (dw_val_node): Add val_symbolic_view. * dwarf2out.c (dw_line_info_table): Add symviews_since_reset. (symview_upper_bound): New. (new_line_info_table): Initialize symviews_since_reset. (dwarf2out_source_line): Count symviews_since_reset and set symview_upper_bound. (dw_val_equal_p): Handle symview. (add_AT_symview): New. (print_dw_val): Handle symview. (attr_checksum, attr_checksum_ordered): Likewise. (same_dw_val_p, size_of_die): Likewise. (value_format, output_die): Likewise. (add_high_low_attributes): Use add_AT_symview for entry_view. (dwarf2out_finish): Reset symview_upper_bound, clear zero_view_p. From-SVN: r258411
2018-03-08re PR debug/84456 (gcc.dg/guality/pr49888.c fail)Jakub Jelinek1-1/+4
PR debug/84456 * dwarf2out.c (dw_loc_list): If list && loc_list->first->next, call gen_llsym, otherwise call maybe_gen_llsym. From-SVN: r258371
2018-03-08[LVU] reset view at function entry, omit views at line zeroAlexandre Oliva1-20/+69
Location views might be associated with locations that lack line number information (line number zero), but since we omit .loc directives that would have been issued with line number zero, we also omit the symbolic view numbers that would have been issued at such points. Resetting views at function entry points address some of these issues, and alleviate the huge chains of symbolic views that have burdened assemblers since we disabled -ginternal-reset-location-views by default, but other problems of undefined views remain when it's not the whole function that lacks line number info, just parts of it. So, when we encounter a request to output a view that may have been referenced, but we decide to omit the .loc because the line is zero, we will now omit the view as well, i.e., we will internally regard that view as zero-numbered. for gcc/ChangeLog PR debug/84404 PR debug/84408 * dwarf2out.c (struct dw_line_info_table): Update comments for view == -1. (FORCE_RESET_NEXT_VIEW): New. (FORCE_RESETTING_VIEW_P): New. (RESETTING_VIEW_P): Check for -1 too. (ZERO_VIEW_P): Likewise. (new_line_info_table): Force-reset next view. (dwarf2out_begin_function): Likewise. (dwarf2out_source_line): Simplify zero_view_p initialization. Test FORCE_RESETTING_VIEW_P and RESETTING_VIEW_P instead of view directly. Omit view when omitting .loc at line 0. for gcc/testsuite/ChangeLog PR debug/84404 PR debug/84408 * gcc.dg/graphite/pr84404.c: New. From-SVN: r258355
2018-03-01re PR debug/84645 (-flto -g0 at compile-time vs. -flto -g at link time ICEs ↵Richard Biener1-2/+4
in add_dwarf_attr, at dwarf2out.c:4353) 2018-03-01 Richard Biener <rguenther@suse.de> PR debug/84645 * dwarf2out.c (gen_variable_die): Properly handle late VLA type annotation with LTO when debug was disabled at compile-time. * gfortran.dg/lto/pr84645_0.f90: New testcase. From-SVN: r258100
2018-02-19re PR target/84146 (ICE with -mcet in dwarf2out_var_location, involving ↵Jakub Jelinek1-6/+16
sigsetjmp) PR target/84146 * reg-notes.def (REG_CALL_ARG_LOCATION): New reg note. * insn-notes.def (NOTE_INSN_CALL_ARG_LOCATION): Remove. * var-tracking.c (emit_note_insn_var_location): Remove all references to NOTE_INSN_CALL_ARG_LOCATION. (emit_notes_in_bb): Emit arguments as REG_CALL_ARG_LOCATION note on the CALL_INSN rather than separate NOTE_INSN_CALL_ARG_LOCATION note. Use copy_rtx_if_shared. * dwarf2out.c (gen_subprogram_die): Use XEXP with 0 instead of NOTE_VAR_LOCATION on ca_loc->call_arg_loc_note. (dwarf2out_var_location): Remove handling of NOTE_INSN_CALL_ARG_LOCATION, instead handle REG_CALL_ARG_LOCATION note on call_insn. * final.c (final_scan_insn): Remove all references to NOTE_INSN_CALL_ARG_LOCATION. (rest_of_clean_state): Likewise. Remove REG_CALL_ARG_LOCATION notes before dumping final insns. * except.c (emit_note_eh_region_end): Remove all references to NOTE_INSN_CALL_ARG_LOCATION. * config/alpha/alpha.c (alpha_pad_function_end): Likewise. * config/c6x/c6x.c (c6x_gen_bundles): Likewise. * config/arc/arc.c (hwloop_optimize): Likewise. * config/arm/arm.c (create_fix_barrier): Likewise. * config/s390/s390.c (s390_chunkify_start): Likewise. * config/sh/sh.c (find_barrier): Likewise. * config/i386/i386.c (rest_of_insert_endbranch, ix86_seh_fixup_eh_fallthru): Likewise. * config/xtensa/xtensa.c (hwloop_optimize): Likewise. * config/iq2000/iq2000.c (final_prescan_insn): Likewise. * config/frv/frv.c (frv_function_prologue): Likewise. * emit-rtl.c (try_split): Likewise. Copy over REG_CALL_ARG_LOCATION reg note. (note_outside_basic_block_p): Remove all references to NOTE_INSN_CALL_ARG_LOCATION. * gengtype.c (adjust_field_rtx_def): Likewise. * print-rtl.c (rtx_writer::print_rtx_operand_code_0, print_insn): Likewise. * jump.c (cleanup_barriers, delete_related_insns): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect): Likewise. * gcc.target/i386/pr84146.c: Add -fcompare-debug to dg-options. From-SVN: r257826
2018-02-13common.opt (gas-loc-support, [...]): New.Alexandre Oliva1-64/+124
* common.opt (gas-loc-support, gas-locview-support): New. (ginline-points, ginternal-reset-location-views): New. * doc/invoke.texi: Document them. Use @itemx where intended. (gvariable-location-views): Adjust. * target.def (reset_location_view): New. * doc/tm.texi.in (DWARF2_ASM_VIEW_DEBUG_INFO): New. (TARGET_RESET_LOCATION_VIEW): New. * doc/tm.texi: Rebuilt. * dwarf2out.c (dwarf2out_default_as_loc_support): New. (dwarf2out_default_as_locview_support): New. (output_asm_line_debug_info): Use option variables. (dwarf2out_maybe_output_loclist_view_pair): Likewise. (output_loc_list): Likewise. (add_high_low_attributes): Check option variables. Don't output entry view attribute in strict mode. (gen_inlined_subroutine_die): Check option variables. (dwarf2out_inline_entry): Likewise. (init_sections_and_labels): Likewise. (dwarf2out_early_finish): Likewise. (maybe_reset_location_view): New, from... (dwarf2out_var_location): ... here. Call it. * debug.h (dwarf2out_default_as_loc_support): Declare. (dwarf2out_default_as_locview_support): Declare. * hooks.c (hook_int_rtx_insn_0): New. * hooks.h (hook_int_rtx_insn_0): Declare. * toplev.c (process_options): Take -gas-loc-support and -gas-locview-support from dwarf2out. Enable -gvariable-location-views by default only with locview assembler support. Enable -ginternal-reset-location-views by default only if the target defines the corresponding hook. Enable -ginline-points by default if location views are enabled; force it disabled if statement frontiers are disabled. * tree-inline.c (expand_call_inline): Check option variables. * tree-ssa-live.c (remove_unused_scope_block_p): Likewise. From-SVN: r257631
2018-02-09DWARF: no location for non-definition DECLs with non-trivial DECL_VALUE_EXPRPierre-Marie de Rodat1-4/+27
This patch restricts the set of cases in which we allow the generation of location attributes for variables that are not defined in the current unit. For such variables with complex DECL_VALUE_EXPR trees, generating a location attribute can end up creating relocations to text symbols in the debug section of LTO object files, which is not valid. gcc/ PR lto/84213 * dwarf2out.c (is_trivial_indirect_ref): New function. (dwarf2out_late_global_decl): Do not generate a location attribute for variables that have a non-trivial DECL_VALUE_EXPR and that are not defined in the current unit. From-SVN: r257526
2018-02-09[IEPM] Introduce inline entry point markersAlexandre Oliva1-3/+196
Output DW_AT_entry_pc based on markers. Introduce DW_AT_GNU_entry_view as a DWARF extension. If views are enabled are we're not in strict compliance mode, output DW_AT_GNU_entry_view if it might be nonzero. This patch depends on SFN and LVU patchsets, and on the IEPM patch that introduces the inline_entry debug hook. for include/ChangeLog * dwarf2.def (DW_AT_GNU_entry_view): New. for gcc/ChangeLog * cfgexpand.c (expand_gimple_basic_block): Handle inline entry markers. * dwarf2out.c (dwarf2_debug_hooks): Enable inline_entry hook. (BLOCK_INLINE_ENTRY_LABEL): New. (dwarf2out_var_location): Disregard inline entry markers. (inline_entry_data): New struct. (inline_entry_data_hasher): New hashtable type. (inline_entry_data_hasher::hash): New. (inline_entry_data_hasher::equal): New. (inline_entry_data_table): New variable. (add_high_low_attributes): Add DW_AT_entry_pc and DW_AT_GNU_entry_view attributes if a pending entry is found in inline_entry_data_table. Add old entry_pc attribute only if debug nonbinding markers are disabled. (gen_inlined_subroutine_die): Set BLOCK_DIE if nonbinding markers are enabled. (block_within_block_p, dwarf2out_inline_entry): New. (dwarf2out_finish): Check that no entries remained in inline_entry_data_table. * final.c (reemit_insn_block_notes): Handle inline entry notes. (final_scan_insn, notice_source_line): Likewise. (rest_of_clean_state): Skip inline entry markers. * gimple-pretty-print.c (dump_gimple_debug): Handle inline entry markers. * gimple.c (gimple_build_debug_inline_entry): New. * gimple.h (enum gimple_debug_subcode): Add GIMPLE_DEBUG_INLINE_ENTRY. (gimple_build_debug_inline_entry): Declare. (gimple_debug_inline_entry_p): New. (gimple_debug_nonbind_marker_p): Adjust. * insn-notes.def (INLINE_ENTRY): New. * print-rtl.c (rtx_writer::print_rtx_operand_code_0): Handle inline entry marker notes. (print_insn): Likewise. * rtl.h (NOTE_MARKER_P): Add INLINE_ENTRY support. (INSN_DEBUG_MARKER_KIND): Likewise. (GEN_RTX_DEBUG_MARKER_INLINE_ENTRY_PAT): New. * tree-inline.c (expand_call_inline): Build and insert debug_inline_entry stmt. * tree-ssa-live.c (remove_unused_scope_block_p): Preserve inline entry blocks early, if nonbind markers are enabled. (dump_scope_block): Dump fragment info. * var-tracking.c (reemit_marker_as_note): Handle inline entry note. * doc/gimple.texi (gimple_debug_inline_entry_p): New. (gimple_build_debug_inline_entry): New. * doc/invoke.texi (gstatement-frontiers, gno-statement-frontiers): Enable/disable inline entry points too. * doc/rtl.texi (NOTE_INSN_INLINE_ENTRY): New. (DEBUG_INSN): Describe inline entry markers. From-SVN: r257511
2018-02-09[LVU] Introduce location viewsAlexandre Oliva1-68/+632
This patch introduces an option to enable the generation of location views along with location lists. The exact format depends on the DWARF version: it can be a separate attribute (DW_AT_GNU_locviews) or (DW_LLE_view_pair) entries in DWARF5+ loclists. Line number tables are also affected. If the assembler is found, at compiler build time, to support .loc views, we use them and assembler-computed view labels, otherwise we output compiler-generated line number programs with conservatively-computed view labels. In either case, we output view information next to line number changes when verbose assembly output is requested. This patch requires an LVU patch that modifies the exported API of final_scan_insn. It also expects the entire SFN patchset to be installed first, although SFN is not a requirement for LVU. for include/ChangeLog * dwarf2.def (DW_AT_GNU_locviews): New. * dwarf2.h (enum dwarf_location_list_entry_type): Add DW_LLE_GNU_view_pair. (DW_LLE_view_pair): Define. for gcc/ChangeLog * common.opt (gvariable-location-views): New. (gvariable-location-views=incompat5): New. * config.in: Rebuilt. * configure: Rebuilt. * configure.ac: Test assembler for view support. * dwarf2asm.c (dw2_asm_output_symname_uleb128): New. * dwarf2asm.h (dw2_asm_output_symname_uleb128): Declare. * dwarf2out.c (var_loc_view): New typedef. (struct dw_loc_list_struct): Add vl_symbol, vbegin, vend. (dwarf2out_locviews_in_attribute): New. (dwarf2out_locviews_in_loclist): New. (dw_val_equal_p): Compare val_view_list of dw_val_class_view_lists. (enum dw_line_info_opcode): Add LI_adv_address. (struct dw_line_info_table): Add view. (RESET_NEXT_VIEW, RESETTING_VIEW_P): New macros. (DWARF2_ASM_VIEW_DEBUG_INFO): Define default. (zero_view_p): New variable. (ZERO_VIEW_P): New macro. (output_asm_line_debug_info): New. (struct var_loc_node): Add view. (add_AT_view_list, AT_loc_list): New. (add_var_loc_to_decl): Add view param. Test it against last. (new_loc_list): Add view params. Record them. (AT_loc_list_ptr): Handle loc and view lists. (view_list_to_loc_list_val_node): New. (print_dw_val): Handle dw_val_class_view_list. (size_of_die): Likewise. (value_format): Likewise. (loc_list_has_views): New. (gen_llsym): Set vl_symbol too. (maybe_gen_llsym, skip_loc_list_entry): New. (dwarf2out_maybe_output_loclist_view_pair): New. (output_loc_list): Output view list or entries too. (output_view_list_offset): New. (output_die): Handle dw_val_class_view_list. (output_dwarf_version): New. (output_compilation_unit_header): Use it. (output_skeleton_debug_sections): Likewise. (output_rnglists, output_line_info): Likewise. (output_pubnames, output_aranges): Update version comments. (output_one_line_info_table): Output view numbers in asm comments. (dw_loc_list): Determine current endview, pass it to new_loc_list. Call maybe_gen_llsym. (loc_list_from_tree_1): Adjust. (add_AT_location_description): Create view list attribute if needed, check it's absent otherwise. (convert_cfa_to_fb_loc_list): Adjust. (maybe_emit_file): Call output_asm_line_debug_info for test. (dwarf2out_var_location): Reset views as needed. Precompute add_var_loc_to_decl args. Call get_attr_min_length only if we have the attribute. Set view. (new_line_info_table): Reset next view. (set_cur_line_info_table): Call output_asm_line_debug_info for test. (dwarf2out_source_line): Likewise. Output view resets and labels to the assembler, or select appropriate line info opcodes. (prune_unused_types_walk_attribs): Handle dw_val_class_view_list. (optimize_string_length): Catch it. Adjust. (resolve_addr): Copy vl_symbol along with ll_symbol. Handle dw_val_class_view_list, and remove it if no longer needed. (hash_loc_list): Hash view numbers. (loc_list_hasher::equal): Compare them. (optimize_location_lists): Check whether a view list symbol is needed, and whether the locview attribute is present, and whether they match. Remove the locview attribute if no longer needed. (index_location_lists): Call skip_loc_list_entry for test. (dwarf2out_finish): Call output_asm_line_debug_info for test. Use output_dwarf_version. * dwarf2out.h (enum dw_val_class): Add dw_val_class_view_list. (struct dw_val_node): Add val_view_list. * final.c (SEEN_NEXT_VIEW): New. (set_next_view_needed): New. (clear_next_view_needed): New. (maybe_output_next_view): New. (final_start_function): Rename to... (final_start_function_1): ... this. Take pointer to FIRST, add SEEN parameter. Emit param bindings in the initial view. (final_start_function): Reintroduce SEEN-less interface. (final): Rename to... (final_1): ... this. Take SEEN parameter. Output final pending next view at the end. (final): Reintroduce seen-less interface. (final_scan_insn): Output pending next view before switching sections or ending a block. Mark the next view as needed when outputting variable locations. Notify debug backend of section changes, and of location view changes. (rest_of_handle_final): Adjust. * toplev.c (process_options): Autodetect value for debug variable location views option. Warn on incompat5 without -gdwarf-5. * doc/invoke.texi (gvariable-location-views): New. (gvariable-location-views=incompat5): New. (gno-variable-location-views): New. From-SVN: r257510
2018-01-18Add ability to remap file names in __FILE__, etc (PR other/70268)Boris Kolpackov1-0/+3
This commit adds the -fmacro-prefix-map option that allows remapping of file names in __FILE__, __BASE_FILE__, and __builtin_FILE(), similar to how -fdebug-prefix-map allows to do the same for debug information. Additionally, it adds -ffile-prefix-map which can be used to specify both mappings with a single option (and, should we need to add more -f*-prefix-map options in the future, those as well). libcpp/ChangeLog: 2018-01-18 Boris Kolpackov <boris@codesynthesis.com> PR other/70268 * include/cpplib.h (cpp_callbacks::remap_filename): New callback. * libcpp/macro.c (_cpp_builtin_macro_text): Call remap_filename for __FILE__ and __BASE_FILE__. gcc/ChangeLog: 2018-01-18 Boris Kolpackov <boris@codesynthesis.com> PR other/70268 * common.opt: (-ffile-prefix-map): New option. * opts.c (common_handle_option): Defer it. * opts-global.c (handle_common_deferred_options): Handle it. * debug.h (remap_debug_filename, add_debug_prefix_map): Move to... * file-prefix-map.h: New file. (remap_debug_filename, add_debug_prefix_map): ...here. (add_macro_prefix_map, add_file_prefix_map, remap_macro_filename): New. * final.c (debug_prefix_map, add_debug_prefix_map remap_debug_filename): Move to... * file-prefix-map.c: New file. (file_prefix_map, add_prefix_map, remap_filename) ...here and rename, generalize, get rid of alloca(), use strrchr() instead of strchr(). (add_macro_prefix_map, add_debug_prefix_map, add_file_prefix_map): Implement in terms of add_prefix_map(). (remap_macro_filename, remap_debug_filename): Implement in term of remap_filename(). * Makefile.in (OBJS, PLUGIN_HEADERS): Add new files. * builtins.c (fold_builtin_FILE): Call remap_macro_filename(). * dbxout.c: Include file-prefix-map.h. * varasm.c: Likewise. * vmsdbgout.c: Likewise. * xcoffout.c: Likewise. * dwarf2out.c: Likewise plus omit new options from DW_AT_producer. * doc/cppopts.texi (-fmacro-prefix-map): Document. * doc/invoke.texi (-ffile-prefix-map): Document. (-fdebug-prefix-map): Update description. gcc/c-family/ChangeLog: 2018-01-18 Boris Kolpackov <boris@codesynthesis.com> PR other/70268 * c-family/c.opt (-fmacro-prefix-map): New option. * c-family/c-opts.c (c_common_handle_option): Handle it. * c-family/c-lex.c (init_c_lex): Set remap_filename cpp callback. * c-family/c-ppoutput.c (init_pp_output): Likewise. gcc/testsuite/ChangeLog: 2018-01-18 Boris Kolpackov <boris@codesynthesis.com> PR other/70268 * c-c++-common/ffile-prefix-map.c: New test. * c-c++-common/fmacro-prefix-map.c: New test. * c-c++-common/cpp/ffile-prefix-map.c: New test. * c-c++-common/cpp/fmacro-prefix-map.c: New test. From-SVN: r256847
2018-01-12re PR debug/83157 (gcc.dg/guality/pr41616-1.c fail, inline instances refer ↵Richard Biener1-3/+1
to concrete instance as abstract origin) 2018-01-12 Richard Biener <rguenther@suse.de> PR debug/83157 * dwarf2out.c (gen_variable_die): Do not reset old_die for inline instance vars. From-SVN: r256580
2018-01-10* dwarf2out.c (dwarf2out_var_location): Do not pass NULL to fprintf.Eric Botcazou1-2/+7
From-SVN: r256454
2018-01-10re PR debug/83765 (LTO bootstrap with Ada fails)Richard Biener1-5/+5
2018-01-10 Richard Biener <rguenther@suse.de> PR debug/83765 * dwarf2out.c (gen_subprogram_die): Hoist old_die && declaration early out so it also covers the case where we have a non-NULL origin. From-SVN: r256428
2018-01-08re PR lto/83719 (ICE (segfault) in hash_table<indirect_string_hasher, ↵Richard Biener1-2/+9
xcallocator>::elements()) 2018-01-08 Richard Biener <rguenther@suse.de> PR lto/83719 * dwarf2out.c (output_indirect_strings): Handle empty skeleton_debug_str_hash. (dwarf2out_early_finish): Index strings for -gsplit-dwarf. * gcc.dg/lto/pr83719_0.c: New testcase. From-SVN: r256338
2018-01-03poly_int: GET_MODE_SIZERichard Sandiford1-18/+41
This patch changes GET_MODE_SIZE from unsigned short to poly_uint16. The non-mechanical parts were handled by previous patches. 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * machmode.h (mode_size): Change from unsigned short to poly_uint16_pod. (mode_to_bytes): Return a poly_uint16 rather than an unsigned short. (GET_MODE_SIZE): Return a constant if ONLY_FIXED_SIZE_MODES, or if measurement_type is not polynomial. (fixed_size_mode::includes_p): Check for constant-sized modes. * genmodes.c (emit_mode_size_inline): Make mode_size_inline return a poly_uint16 rather than an unsigned short. (emit_mode_size): Change the type of mode_size from unsigned short to poly_uint16_pod. Use ZERO_COEFFS for the initializer. (emit_mode_adjustments): Cope with polynomial vector sizes. * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value for GET_MODE_SIZE. * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value for GET_MODE_SIZE. * auto-inc-dec.c (try_merge): Treat GET_MODE_SIZE as polynomial. * builtins.c (expand_ifn_atomic_compare_exchange_into_call): Likewise. * caller-save.c (setup_save_areas): Likewise. (replace_reg_with_saved_mem): Likewise. * calls.c (emit_library_call_value_1): Likewise. * combine-stack-adj.c (combine_stack_adjustments_for_block): Likewise. * combine.c (simplify_set, make_extraction, simplify_shift_const_1) (gen_lowpart_for_combine): Likewise. * convert.c (convert_to_integer_1): Likewise. * cse.c (equiv_constant, cse_insn): Likewise. * cselib.c (autoinc_split, cselib_hash_rtx): Likewise. (cselib_subst_to_values): Likewise. * dce.c (word_dce_process_block): Likewise. * df-problems.c (df_word_lr_mark_ref): Likewise. * dwarf2cfi.c (init_one_dwarf_reg_size): Likewise. * dwarf2out.c (multiple_reg_loc_descriptor, mem_loc_descriptor) (concat_loc_descriptor, concatn_loc_descriptor, loc_descriptor) (rtl_for_decl_location): Likewise. * emit-rtl.c (gen_highpart, widen_memory_access): Likewise. * expmed.c (extract_bit_field_1, extract_integral_bit_field): Likewise. * expr.c (emit_group_load_1, clear_storage_hints): Likewise. (emit_move_complex, emit_move_multi_word, emit_push_insn): Likewise. (expand_expr_real_1): Likewise. * function.c (assign_parm_setup_block_p, assign_parm_setup_block) (pad_below): Likewise. * gimple-fold.c (optimize_atomic_compare_exchange_p): Likewise. * gimple-ssa-store-merging.c (rhs_valid_for_store_merging_p): Likewise. * ira.c (get_subreg_tracking_sizes): Likewise. * ira-build.c (ira_create_allocno_objects): Likewise. * ira-color.c (coalesced_pseudo_reg_slot_compare): Likewise. (ira_sort_regnos_for_alter_reg): Likewise. * ira-costs.c (record_operand_costs): Likewise. * lower-subreg.c (interesting_mode_p, simplify_gen_subreg_concatn) (resolve_simple_move): Likewise. * lra-constraints.c (get_reload_reg, operands_match_p): Likewise. (process_addr_reg, simplify_operand_subreg, curr_insn_transform) (lra_constraints): Likewise. (CONST_POOL_OK_P): Reject variable-sized modes. * lra-spills.c (slot, assign_mem_slot, pseudo_reg_slot_compare) (add_pseudo_to_slot, lra_spill): Likewise. * omp-low.c (omp_clause_aligned_alignment): Likewise. * optabs-query.c (get_best_extraction_insn): Likewise. * optabs-tree.c (expand_vec_cond_expr_p): Likewise. * optabs.c (expand_vec_perm_var, expand_vec_cond_expr): Likewise. (expand_mult_highpart, valid_multiword_target_p): Likewise. * recog.c (offsettable_address_addr_space_p): Likewise. * regcprop.c (maybe_mode_change): Likewise. * reginfo.c (choose_hard_reg_mode, record_subregs_of_mode): Likewise. * regrename.c (build_def_use): Likewise. * regstat.c (dump_reg_info): Likewise. * reload.c (complex_word_subreg_p, push_reload, find_dummy_reload) (find_reloads, find_reloads_subreg_address): Likewise. * reload1.c (eliminate_regs_1): Likewise. * rtlanal.c (for_each_inc_dec_find_inc_dec, rtx_cost): Likewise. * simplify-rtx.c (avoid_constant_pool_reference): Likewise. (simplify_binary_operation_1, simplify_subreg): Likewise. * targhooks.c (default_function_arg_padding): Likewise. (default_hard_regno_nregs, default_class_max_nregs): Likewise. * tree-cfg.c (verify_gimple_assign_binary): Likewise. (verify_gimple_assign_ternary): Likewise. * tree-inline.c (estimate_move_cost): Likewise. * tree-ssa-forwprop.c (simplify_vector_constructor): Likewise. * tree-ssa-loop-ivopts.c (add_autoinc_candidates): Likewise. (get_address_cost_ainc): Likewise. * tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Likewise. (vect_supportable_dr_alignment): Likewise. * tree-vect-loop.c (vect_determine_vectorization_factor): Likewise. (vectorizable_reduction): Likewise. * tree-vect-stmts.c (vectorizable_assignment, vectorizable_shift) (vectorizable_operation, vectorizable_load): Likewise. * tree.c (build_same_sized_truth_vector_type): Likewise. * valtrack.c (cleanup_auto_inc_dec): Likewise. * var-tracking.c (emit_note_insn_var_location): Likewise. * config/arc/arc.h (ASM_OUTPUT_CASE_END): Use as_a <scalar_int_mode>. (ADDR_VEC_ALIGN): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r256201
2018-01-03poly_int: GET_MODE_BITSIZERichard Sandiford1-1/+2
This patch changes GET_MODE_BITSIZE from an unsigned short to a poly_uint16. 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * machmode.h (mode_to_bits): Return a poly_uint16 rather than an unsigned short. (GET_MODE_BITSIZE): Return a constant if ONLY_FIXED_SIZE_MODES, or if measurement_type is polynomial. * calls.c (shift_return_value): Treat GET_MODE_BITSIZE as polynomial. * combine.c (make_extraction): Likewise. * dse.c (find_shift_sequence): Likewise. * dwarf2out.c (mem_loc_descriptor): Likewise. * expmed.c (store_integral_bit_field, extract_bit_field_1): Likewise. (extract_bit_field, extract_low_bits): Likewise. * expr.c (convert_move, convert_modes, emit_move_insn_1): Likewise. (optimize_bitfield_assignment_op, expand_assignment): Likewise. (store_expr_with_bounds, store_field, expand_expr_real_1): Likewise. * fold-const.c (optimize_bit_field_compare, merge_ranges): Likewise. * gimple-fold.c (optimize_atomic_compare_exchange_p): Likewise. * reload.c (find_reloads): Likewise. * reload1.c (alter_reg): Likewise. * stor-layout.c (bitwise_mode_for_mode, compute_record_mode): Likewise. * targhooks.c (default_secondary_memory_needed_mode): Likewise. * tree-if-conv.c (predicate_mem_writes): Likewise. * tree-ssa-strlen.c (handle_builtin_memcmp): Likewise. * tree-vect-patterns.c (adjust_bool_pattern): Likewise. * tree-vect-stmts.c (vectorizable_simd_clone_call): Likewise. * valtrack.c (dead_debug_insert_temp): Likewise. * varasm.c (mergeable_constant_section): Likewise. * config/sh/sh.h (LOCAL_ALIGNMENT): Use as_a <fixed_size_mode>. gcc/ada/ * gcc-interface/misc.c (enumerate_modes): Treat GET_MODE_BITSIZE as polynomial. gcc/c-family/ * c-ubsan.c (ubsan_instrument_shift): Treat GET_MODE_BITSIZE as polynomial. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r256200
2018-01-03poly_int: GET_MODE_NUNITSRichard Sandiford1-2/+8
This patch changes GET_MODE_NUNITS from unsigned char to poly_uint16, although it remains a macro when compiling target code with NUM_POLY_INT_COEFFS == 1. We can handle permuted loads and stores for variable nunits if the number of statements is a power of 2, but not otherwise. The to_constant call in make_vector_type goes away in a later patch. 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * machmode.h (mode_nunits): Change from unsigned char to poly_uint16_pod. (ONLY_FIXED_SIZE_MODES): New macro. (pod_mode::measurement_type, scalar_int_mode::measurement_type) (scalar_float_mode::measurement_type, scalar_mode::measurement_type) (complex_mode::measurement_type, fixed_size_mode::measurement_type): New typedefs. (mode_to_nunits): Return a poly_uint16 rather than an unsigned short. (GET_MODE_NUNITS): Return a constant if ONLY_FIXED_SIZE_MODES, or if measurement_type is not polynomial. * genmodes.c (ZERO_COEFFS): New macro. (emit_mode_nunits_inline): Make mode_nunits_inline return a poly_uint16. (emit_mode_nunits): Change the type of mode_nunits to poly_uint16_pod. Use ZERO_COEFFS when emitting initializers. * data-streamer.h (bp_pack_poly_value): New function. (bp_unpack_poly_value): Likewise. * lto-streamer-in.c (lto_input_mode_table): Use bp_unpack_poly_value for GET_MODE_NUNITS. * lto-streamer-out.c (lto_write_mode_table): Use bp_pack_poly_value for GET_MODE_NUNITS. * tree.c (make_vector_type): Remove temporary shim and make the real function take the number of units as a poly_uint64 rather than an int. (build_vector_type_for_mode): Handle polynomial nunits. * dwarf2out.c (loc_descriptor, add_const_value_attribute): Likewise. * emit-rtl.c (const_vec_series_p_1): Likewise. (gen_rtx_CONST_VECTOR): Likewise. * fold-const.c (test_vec_duplicate_folding): Likewise. * genrecog.c (validate_pattern): Likewise. * optabs-query.c (can_vec_perm_var_p, can_mult_highpart_p): Likewise. * optabs-tree.c (expand_vec_cond_expr_p): Likewise. * optabs.c (expand_vector_broadcast, expand_binop_directly): Likewise. (shift_amt_for_vec_perm_mask, expand_vec_perm_var): Likewise. (expand_vec_cond_expr, expand_mult_highpart): Likewise. * rtlanal.c (subreg_get_info): Likewise. * tree-vect-data-refs.c (vect_grouped_store_supported): Likewise. (vect_grouped_load_supported): Likewise. * tree-vect-generic.c (type_for_widest_vector_mode): Likewise. * tree-vect-loop.c (have_whole_vector_shift): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. (simplify_const_unary_operation, simplify_binary_operation_1) (simplify_const_binary_operation, simplify_ternary_operation) (test_vector_ops_duplicate, test_vector_ops): Likewise. (simplify_immed_subreg): Use GET_MODE_NUNITS on a fixed_size_mode instead of CONST_VECTOR_NUNITS. * varasm.c (output_constant_pool_2): Likewise. * rtx-vector-builder.c (rtx_vector_builder::build): Only include the explicit-encoded elements in the XVEC for variable-length vectors. gcc/ada/ * gcc-interface/misc.c (enumerate_modes): Handle polynomial GET_MODE_NUNITS. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r256195
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-12-21poly_int: get_inner_reference & co.Richard Sandiford1-19/+25
This patch makes get_inner_reference and ptr_difference_const return the bit size and bit position as poly_int64s rather than HOST_WIDE_INTS. The non-mechanical changes were handled by previous patches. 2017-12-21 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * tree.h (get_inner_reference): Return the bitsize and bitpos as poly_int64_pods rather than HOST_WIDE_INT. * fold-const.h (ptr_difference_const): Return the pointer difference as a poly_int64_pod rather than a HOST_WIDE_INT. * expr.c (get_inner_reference): Return the bitsize and bitpos as poly_int64_pods rather than HOST_WIDE_INT. (expand_expr_addr_expr_1, expand_expr_real_1): Track polynomial offsets and sizes. * fold-const.c (make_bit_field_ref): Take the bitpos as a poly_int64 rather than a HOST_WIDE_INT. Update call to get_inner_reference. (optimize_bit_field_compare): Update call to get_inner_reference. (decode_field_reference): Likewise. (fold_unary_loc): Track polynomial offsets and sizes. (split_address_to_core_and_offset): Return the bitpos as a poly_int64_pod rather than a HOST_WIDE_INT. (ptr_difference_const): Likewise for the pointer difference. * asan.c (instrument_derefs): Track polynomial offsets and sizes. * config/mips/mips.c (r10k_safe_mem_expr_p): Likewise. * dbxout.c (dbxout_expand_expr): Likewise. * dwarf2out.c (loc_list_for_address_of_addr_expr_of_indirect_ref) (loc_list_from_tree_1, fortran_common): Likewise. * gimple-laddress.c (pass_laddress::execute): Likewise. * gimple-ssa-store-merging.c (find_bswap_or_nop_load): Likewise. * gimplify.c (gimplify_scan_omp_clauses): Likewise. * simplify-rtx.c (delegitimize_mem_from_attrs): Likewise. * tree-affine.c (tree_to_aff_combination): Likewise. (get_inner_reference_aff): Likewise. * tree-data-ref.c (split_constant_offset_1): Likewise. (dr_analyze_innermost): Likewise. * tree-scalar-evolution.c (interpret_rhs_expr): Likewise. * tree-sra.c (ipa_sra_check_caller): Likewise. * tree-vect-data-refs.c (vect_check_gather_scatter): Likewise. * ubsan.c (maybe_instrument_pointer_overflow): Likewise. (instrument_bool_enum_load, instrument_object_size): Likewise. * gimple-ssa-strength-reduction.c (slsr_process_ref): Update call to get_inner_reference. * hsa-gen.c (gen_hsa_addr): Likewise. * sanopt.c (maybe_optimize_ubsan_ptr_ifn): Likewise. * tsan.c (instrument_expr): Likewise. * match.pd: Update call to ptr_difference_const. gcc/ada/ * gcc-interface/trans.c (Attribute_to_gnu): Track polynomial offsets and sizes. * gcc-interface/utils2.c (build_unary_op): Likewise. gcc/cp/ * constexpr.c (check_automatic_or_tls): Track polynomial offsets and sizes. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255914
2017-12-20poly_int: get_ref_base_and_extentRichard Sandiford1-8/+6
This patch changes the types of the bit offsets and sizes returned by get_ref_base_and_extent to poly_int64. There are some callers that can't sensibly operate on polynomial offsets or handle cases where the offset and size aren't known exactly. This includes the IPA devirtualisation code (since there's no defined way of having vtables at variable offsets) and some parts of the DWARF code. The patch therefore adds a helper function get_ref_base_and_extent_hwi that either returns exact HOST_WIDE_INT bit positions and sizes or returns a null base to indicate failure. 2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * tree-dfa.h (get_ref_base_and_extent): Return the base, size and max_size as poly_int64_pods rather than HOST_WIDE_INTs. (get_ref_base_and_extent_hwi): Declare. * tree-dfa.c (get_ref_base_and_extent): Return the base, size and max_size as poly_int64_pods rather than HOST_WIDE_INTs. (get_ref_base_and_extent_hwi): New function. * cfgexpand.c (expand_debug_expr): Update call to get_ref_base_and_extent. * dwarf2out.c (add_var_loc_to_decl): Likewise. * gimple-fold.c (get_base_constructor): Return the offset as a poly_int64_pod rather than a HOST_WIDE_INT. (fold_const_aggregate_ref_1): Track polynomial sizes and offsets. * ipa-polymorphic-call.c (ipa_polymorphic_call_context::set_by_invariant) (extr_type_from_vtbl_ptr_store): Track polynomial offsets. (ipa_polymorphic_call_context::ipa_polymorphic_call_context) (check_stmt_for_type_change): Use get_ref_base_and_extent_hwi rather than get_ref_base_and_extent. (ipa_polymorphic_call_context::get_dynamic_type): Likewise. * ipa-prop.c (ipa_load_from_parm_agg, compute_complex_assign_jump_func) (get_ancestor_addr_info, determine_locally_known_aggregate_parts): Likewise. * ipa-param-manipulation.c (ipa_get_adjustment_candidate): Update call to get_ref_base_and_extent. * tree-sra.c (create_access, get_access_for_expr): Likewise. * tree-ssa-alias.c (ao_ref_base, aliasing_component_refs_p) (stmt_kills_ref_p): Likewise. * tree-ssa-dce.c (mark_aliased_reaching_defs_necessary_1): Likewise. * tree-ssa-scopedtables.c (avail_expr_hash, equal_mem_array_ref_p): Likewise. * tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise. Use get_ref_base_and_extent_hwi rather than get_ref_base_and_extent when calling native_encode_expr. * tree-ssa-structalias.c (get_constraint_for_component_ref): Update call to get_ref_base_and_extent. (do_structure_copy): Use get_ref_base_and_extent_hwi rather than get_ref_base_and_extent. * var-tracking.c (track_expr_p): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255886
2017-12-20poly_int: DWARF CFA offsetsRichard Sandiford1-0/+3
This patch makes the DWARF code use poly_int64 rather than HOST_WIDE_INT for CFA offsets. The main changes are: - to make reg_save use a DW_CFA_expression representation when the offset isn't constant and - to record the CFA information alongside a def_cfa_expression if either offset is polynomial, since it's quite difficult to reconstruct the CFA information otherwise. 2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * gengtype.c (main): Handle poly_int64_pod. * dwarf2out.h (dw_cfi_oprnd_cfa_loc): New dw_cfi_oprnd_type. (dw_cfi_oprnd::dw_cfi_cfa_loc): New field. (dw_cfa_location::offset, dw_cfa_location::base_offset): Change from HOST_WIDE_INT to poly_int64_pod. * dwarf2cfi.c (queued_reg_save::cfa_offset): Likewise. (copy_cfa): New function. (lookup_cfa_1): Use the cached dw_cfi_cfa_loc, if it exists. (cfi_oprnd_equal_p): Handle dw_cfi_oprnd_cfa_loc. (cfa_equal_p, dwarf2out_frame_debug_adjust_cfa) (dwarf2out_frame_debug_cfa_offset, dwarf2out_frame_debug_expr) (initial_return_save): Treat offsets as poly_ints. (def_cfa_0): Likewise. Cache the CFA in dw_cfi_cfa_loc if either offset is nonconstant. (reg_save): Take the offset as a poly_int64. Fall back to DW_CFA_expression for nonconstant offsets. (queue_reg_save): Take the offset as a poly_int64. * dwarf2out.c (dw_cfi_oprnd2_desc): Handle DW_CFA_def_cfa_expression. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255884
2017-12-20poly_int: SUBREG_BYTERichard Sandiford1-3/+3
This patch changes SUBREG_BYTE from an int to a poly_int. Since valid SUBREG_BYTEs must be contained within the mode of the SUBREG_REG, the required range is the same as for GET_MODE_SIZE, i.e. unsigned short. The patch therefore uses poly_uint16(_pod) for the SUBREG_BYTE. Using poly_uint16_pod rtx fields requires a new field code ('p'). Since there are no other uses of 'p' besides SUBREG_BYTE, the patch doesn't add an XPOLY or whatever; all uses should go via SUBREG_BYTE instead. The patch doesn't bother implementing 'p' support for legacy define_peepholes, since none of the remaining ones have subregs in their patterns. As it happened, the rtl documentation used SUBREG as an example of a code with mixed field types, accessed via XEXP (x, 0) and XINT (x, 1). Since there's no direct replacement for XINT, and since people should never use it even if there were, the patch changes the example to use INT_LIST instead. The patch also changes subreg-related helper functions so that they too take and return polynomial offsets. This makes the patch quite big, but it's mostly mechanical. The patch generally sticks to existing choices wrt signedness. 2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * doc/rtl.texi: Update documentation of SUBREG_BYTE. Document the 'p' format code. Use INT_LIST rather than SUBREG as the example of a code with an XINT and an XEXP. Remove the implication that accessing an rtx field using XINT is expected to work. * rtl.def (SUBREG): Change format from "ei" to "ep". * rtl.h (rtunion::rt_subreg): New field. (XCSUBREG): New macro. (SUBREG_BYTE): Use it. (subreg_shape): Change offset from an unsigned int to a poly_uint16. Update constructor accordingly. (subreg_shape::operator ==): Update accordingly. (subreg_shape::unique_id): Return an unsigned HOST_WIDE_INT rather than an unsigned int. (subreg_lsb, subreg_lowpart_offset, subreg_highpart_offset): Return a poly_uint64 rather than an unsigned int. (subreg_lsb_1): Likewise. Take the offset as a poly_uint64 rather than an unsigned int. (subreg_size_offset_from_lsb, subreg_size_lowpart_offset) (subreg_size_highpart_offset): Return a poly_uint64 rather than an unsigned int. Take the sizes as poly_uint64s. (subreg_offset_from_lsb): Return a poly_uint64 rather than an unsigned int. Take the shift as a poly_uint64 rather than an unsigned int. (subreg_regno_offset, subreg_offset_representable_p): Take the offset as a poly_uint64 rather than an unsigned int. (simplify_subreg_regno): Likewise. (byte_lowpart_offset): Return the memory offset as a poly_int64 rather than an int. (subreg_memory_offset): Likewise. Take the subreg offset as a poly_uint64 rather than an unsigned int. (simplify_subreg, simplify_gen_subreg, subreg_get_info) (gen_rtx_SUBREG, validate_subreg): Take the subreg offset as a poly_uint64 rather than an unsigned int. * rtl.c (rtx_format): Describe 'p' in comment. (copy_rtx, rtx_equal_p_cb, rtx_equal_p): Handle 'p'. * emit-rtl.c (validate_subreg, gen_rtx_SUBREG): Take the subreg offset as a poly_uint64 rather than an unsigned int. (byte_lowpart_offset): Return the memory offset as a poly_int64 rather than an int. (subreg_memory_offset): Likewise. Take the subreg offset as a poly_uint64 rather than an unsigned int. (subreg_size_lowpart_offset, subreg_size_highpart_offset): Take the mode sizes as poly_uint64s rather than unsigned ints. Return a poly_uint64 rather than an unsigned int. (subreg_lowpart_p): Treat subreg offsets as poly_ints. (copy_insn_1): Handle 'p'. * rtlanal.c (set_noop_p): Treat subregs offsets as poly_uint64s. (subreg_lsb_1): Take the subreg offset as a poly_uint64 rather than an unsigned int. Return the shift in the same way. (subreg_lsb): Return the shift as a poly_uint64 rather than an unsigned int. (subreg_size_offset_from_lsb): Take the sizes and shift as poly_uint64s rather than unsigned ints. Return the offset as a poly_uint64. (subreg_get_info, subreg_regno_offset, subreg_offset_representable_p) (simplify_subreg_regno): Take the offset as a poly_uint64 rather than an unsigned int. * rtlhash.c (add_rtx): Handle 'p'. * genemit.c (gen_exp): Likewise. * gengenrtl.c (type_from_format, gendef): Likewise. * gensupport.c (subst_pattern_match, get_alternatives_number) (collect_insn_data, alter_predicate_for_insn, alter_constraints) (subst_dup): Likewise. * gengtype.c (adjust_field_rtx_def): Likewise. * genrecog.c (find_operand, find_matching_operand, validate_pattern) (match_pattern_2): Likewise. (rtx_test::SUBREG_FIELD): New rtx_test::kind_enum. (rtx_test::subreg_field): New function. (operator ==, safe_to_hoist_p, transition_parameter_type) (print_nonbool_test, print_test): Handle SUBREG_FIELD. * genattrtab.c (attr_rtx_1): Say that 'p' is deliberately not handled. * genpeep.c (match_rtx): Likewise. * print-rtl.c (print_poly_int): Include if GENERATOR_FILE too. (rtx_writer::print_rtx_operand): Handle 'p'. (print_value): Handle SUBREG. * read-rtl.c (apply_int_iterator): Likewise. (rtx_reader::read_rtx_operand): Handle 'p'. * alias.c (rtx_equal_for_memref_p): Likewise. * cselib.c (rtx_equal_for_cselib_1, cselib_hash_rtx): Likewise. * caller-save.c (replace_reg_with_saved_mem): Treat subreg offsets as poly_ints. * calls.c (expand_call): Likewise. * combine.c (combine_simplify_rtx, expand_field_assignment): Likewise. (make_extraction, gen_lowpart_for_combine): Likewise. * loop-invariant.c (hash_invariant_expr_1, invariant_expr_equal_p): Likewise. * cse.c (remove_invalid_subreg_refs): Take the offset as a poly_uint64 rather than an unsigned int. Treat subreg offsets as poly_ints. (exp_equiv_p): Handle 'p'. (hash_rtx_cb): Likewise. Treat subreg offsets as poly_ints. (equiv_constant, cse_insn): Treat subreg offsets as poly_ints. * dse.c (find_shift_sequence): Likewise. * dwarf2out.c (rtl_for_decl_location): Likewise. * expmed.c (extract_low_bits): Likewise. * expr.c (emit_group_store, undefined_operand_subword_p): Likewise. (expand_expr_real_2): Likewise. * final.c (alter_subreg): Likewise. (leaf_renumber_regs_insn): Handle 'p'. * function.c (assign_parm_find_stack_rtl, assign_parm_setup_stack): Treat subreg offsets as poly_ints. * fwprop.c (forward_propagate_and_simplify): Likewise. * ifcvt.c (noce_emit_move_insn, noce_emit_cmove): Likewise. * ira.c (get_subreg_tracking_sizes): Likewise. * ira-conflicts.c (go_through_subreg): Likewise. * ira-lives.c (process_single_reg_class_operands): Likewise. * jump.c (rtx_renumbered_equal_p): Likewise. Handle 'p'. * lower-subreg.c (simplify_subreg_concatn): Take the subreg offset as a poly_uint64 rather than an unsigned int. (simplify_gen_subreg_concatn, resolve_simple_move): Treat subreg offsets as poly_ints. * lra-constraints.c (operands_match_p): Handle 'p'. (match_reload, curr_insn_transform): Treat subreg offsets as poly_ints. * lra-spills.c (assign_mem_slot): Likewise. * postreload.c (move2add_valid_value_p): Likewise. * recog.c (general_operand, indirect_operand): Likewise. * regcprop.c (copy_value, maybe_mode_change): Likewise. (copyprop_hardreg_forward_1): Likewise. * reginfo.c (simplifiable_subregs_hasher::hash, simplifiable_subregs) (record_subregs_of_mode): Likewise. * rtlhooks.c (gen_lowpart_general, gen_lowpart_if_possible): Likewise. * reload.c (operands_match_p): Handle 'p'. (find_reloads_subreg_address): Treat subreg offsets as poly_ints. * reload1.c (alter_reg, choose_reload_regs): Likewise. (compute_reload_subreg_offset): Likewise, and return an poly_int64. * simplify-rtx.c (simplify_truncation, simplify_binary_operation_1): (test_vector_ops_duplicate): Treat subreg offsets as poly_ints. (simplify_const_poly_int_tests<N>::run): Likewise. (simplify_subreg, simplify_gen_subreg): Take the subreg offset as a poly_uint64 rather than an unsigned int. * valtrack.c (debug_lowpart_subreg): Likewise. * var-tracking.c (var_lowpart): Likewise. (loc_cmp): Handle 'p'. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255882
2017-12-20poly_int: MEM_OFFSET and MEM_SIZERichard Sandiford1-3/+5
This patch changes the MEM_OFFSET and MEM_SIZE memory attributes from HOST_WIDE_INT to poly_int64. Most of it is mechanical, but there is one nonbovious change in widen_memory_access. Previously the main while loop broke with: /* Similarly for the decl. */ else if (DECL_P (attrs.expr) && DECL_SIZE_UNIT (attrs.expr) && TREE_CODE (DECL_SIZE_UNIT (attrs.expr)) == INTEGER_CST && compare_tree_int (DECL_SIZE_UNIT (attrs.expr), size) >= 0 && (! attrs.offset_known_p || attrs.offset >= 0)) break; but it seemed wrong to optimistically assume the best case when the offset isn't known (and thus might be negative). As it happens, the "! attrs.offset_known_p" condition was always false, because we'd already nullified attrs.expr in that case: /* If we don't know what offset we were at within the expression, then we can't know if we've overstepped the bounds. */ if (! attrs.offset_known_p) attrs.expr = NULL_TREE; The patch therefore drops "! attrs.offset_known_p ||" when converting the offset check to the may/must interface. 2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * rtl.h (mem_attrs): Add a default constructor. Change size and offset from HOST_WIDE_INT to poly_int64. * emit-rtl.h (set_mem_offset, set_mem_size, adjust_address_1) (adjust_automodify_address_1, set_mem_attributes_minus_bitpos) (widen_memory_access): Take the sizes and offsets as poly_int64s rather than HOST_WIDE_INTs. * alias.c (ao_ref_from_mem): Handle the new form of MEM_OFFSET. (offset_overlap_p): Take poly_int64s rather than HOST_WIDE_INTs and ints. (adjust_offset_for_component_ref): Change the offset from a HOST_WIDE_INT to a poly_int64. (nonoverlapping_memrefs_p): Track polynomial offsets and sizes. * cfgcleanup.c (merge_memattrs): Update after mem_attrs changes. * dce.c (find_call_stack_args): Likewise. * dse.c (record_store): Likewise. * dwarf2out.c (tls_mem_loc_descriptor, dw_sra_loc_expr): Likewise. * print-rtl.c (rtx_writer::print_rtx): Likewise. * read-rtl-function.c (test_loading_mem): Likewise. * rtlanal.c (may_trap_p_1): Likewise. * simplify-rtx.c (delegitimize_mem_from_attrs): Likewise. * var-tracking.c (int_mem_offset, track_expr_p): Likewise. * emit-rtl.c (mem_attrs_eq_p, get_mem_align_offset): Likewise. (mem_attrs::mem_attrs): New function. (set_mem_attributes_minus_bitpos): Change bitpos from a HOST_WIDE_INT to poly_int64. (set_mem_alias_set, set_mem_addr_space, set_mem_align, set_mem_expr) (clear_mem_offset, clear_mem_size, change_address) (get_spill_slot_decl, set_mem_attrs_for_spill): Directly initialize mem_attrs. (set_mem_offset, set_mem_size, adjust_address_1) (adjust_automodify_address_1, offset_address, widen_memory_access): Likewise. Take poly_int64s rather than HOST_WIDE_INT. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255875
2017-12-20poly_int: DWARF locationsRichard Sandiford1-49/+111
This patch adds support for DWARF location expressions that involve polynomial offsets. It adds a target hook that says how the runtime invariants used in the offsets should be represented in DWARF. SVE vectors have to be a multiple of 128 bits in size, so the GCC port uses the number of 128-bit blocks minus one as the runtime invariant. However, in DWARF, the vector length is exposed via a pseudo "VG" register that holds the number of 64-bit elements in a vector. Thus: indeterminate 1 == (VG / 2) - 1 The hook needs to be general enough to express this. Note that in most cases the division and subtraction fold away into surrounding expressions. 2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * target.def (dwarf_poly_indeterminate_value): New hook. * targhooks.h (default_dwarf_poly_indeterminate_value): Declare. * targhooks.c (default_dwarf_poly_indeterminate_value): New function. * doc/tm.texi.in (TARGET_DWARF_POLY_INDETERMINATE_VALUE): Document. * doc/tm.texi: Regenerate. * dwarf2out.h (build_cfa_loc, build_cfa_aligned_loc): Take the offset as a poly_int64. * dwarf2out.c (new_reg_loc_descr): Move later in file. Take the offset as a poly_int64. (loc_descr_plus_const, loc_list_plus_const, build_cfa_aligned_loc): Take the offset as a poly_int64. (build_cfa_loc): Likewise. Use loc_descr_plus_const. (frame_pointer_fb_offset): Change to a poly_int64. (int_loc_descriptor): Take the offset as a poly_int64. Use targetm.dwarf_poly_indeterminate_value for polynomial offsets. (based_loc_descr): Take the offset as a poly_int64. Use strip_offset_and_add to handle (plus X (const)). Use new_reg_loc_descr instead of an open-coded version of the previous implementation. (mem_loc_descriptor): Handle CONST_POLY_INT. (compute_frame_pointer_to_fb_displacement): Take the offset as a poly_int64. Use strip_offset_and_add to handle (plus X (const)). Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255868
2017-12-20poly_int: rtx constantsRichard Sandiford1-0/+10
This patch adds an rtl representation of poly_int values. There were three possible ways of doing this: (1) Add a new rtl code for the poly_ints themselves and store the coefficients as trailing wide_ints. This would give constants like: (const_poly_int [c0 c1 ... cn]) The runtime value would be: c0 + c1 * x1 + ... + cn * xn (2) Like (1), but use rtxes for the coefficients. This would give constants like: (const_poly_int [(const_int c0) (const_int c1) ... (const_int cn)]) although the coefficients could be const_wide_ints instead of const_ints where appropriate. (3) Add a new rtl code for the polynomial indeterminates, then use them in const wrappers. A constant like c0 + c1 * x1 would then look like: (const:M (plus:M (mult:M (const_param:M x1) (const_int c1)) (const_int c0))) There didn't seem to be that much to choose between them. The main advantage of (1) is that it's a more efficient representation and that we can refer to the cofficients directly as wide_int_storage. 2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * doc/rtl.texi (const_poly_int): Document. Also document the rtl sharing behavior. * gengenrtl.c (excluded_rtx): Return true for CONST_POLY_INT. * rtl.h (const_poly_int_def): New struct. (rtx_def::u): Add a cpi field. (CASE_CONST_UNIQUE, CASE_CONST_ANY): Add CONST_POLY_INT. (CONST_POLY_INT_P, CONST_POLY_INT_COEFFS): New macros. (wi::rtx_to_poly_wide_ref): New typedef (const_poly_int_value, wi::to_poly_wide, rtx_to_poly_int64) (poly_int_rtx_p): New functions. (trunc_int_for_mode): Declare a poly_int64 version. (plus_constant): Take a poly_int64 instead of a HOST_WIDE_INT. (immed_wide_int_const): Take a poly_wide_int_ref rather than a wide_int_ref. (strip_offset): Declare. (strip_offset_and_add): New function. * rtl.def (CONST_POLY_INT): New rtx code. * rtl.c (rtx_size): Handle CONST_POLY_INT. (shared_const_p): Use poly_int_rtx_p. * emit-rtl.h (gen_int_mode): Take a poly_int64 instead of a HOST_WIDE_INT. (gen_int_shift_amount): Likewise. * emit-rtl.c (const_poly_int_hasher): New class. (const_poly_int_htab): New variable. (init_emit_once): Initialize it when NUM_POLY_INT_COEFFS > 1. (const_poly_int_hasher::hash): New function. (const_poly_int_hasher::equal): Likewise. (gen_int_mode): Take a poly_int64 instead of a HOST_WIDE_INT. (immed_wide_int_const): Rename to... (immed_wide_int_const_1): ...this and make static. (immed_wide_int_const): New function, taking a poly_wide_int_ref instead of a wide_int_ref. (gen_int_shift_amount): Take a poly_int64 instead of a HOST_WIDE_INT. (gen_lowpart_common): Handle CONST_POLY_INT. * cse.c (hash_rtx_cb, equiv_constant): Likewise. * cselib.c (cselib_hash_rtx): Likewise. * dwarf2out.c (const_ok_for_output_1): Likewise. * expr.c (convert_modes): Likewise. * print-rtl.c (rtx_writer::print_rtx, print_value): Likewise. * rtlhash.c (add_rtx): Likewise. * explow.c (trunc_int_for_mode): Add a poly_int64 version. (plus_constant): Take a poly_int64 instead of a HOST_WIDE_INT. Handle existing CONST_POLY_INT rtxes. * expmed.h (expand_shift): Take a poly_int64 instead of a HOST_WIDE_INT. * expmed.c (expand_shift): Likewise. * rtlanal.c (strip_offset): New function. (commutative_operand_precedence): Give CONST_POLY_INT the same precedence as CONST_DOUBLE and put CONST_WIDE_INT between that and CONST_INT. * rtl-tests.c (const_poly_int_tests): New struct. (rtl_tests_c_tests): Use it. * simplify-rtx.c (simplify_const_unary_operation): Handle CONST_POLY_INT. (simplify_const_binary_operation): Likewise. (simplify_binary_operation_1): Fold additions of symbolic constants and CONST_POLY_INTs. (simplify_subreg): Handle extensions and truncations of CONST_POLY_INTs. (simplify_const_poly_int_tests): New struct. (simplify_rtx_c_tests): Use it. * wide-int.h (storage_ref): Add default constructor. (wide_int_ref_storage): Likewise. (trailing_wide_ints): Use GTY((user)). (trailing_wide_ints::operator[]): Add a const version. (trailing_wide_ints::get_precision): New function. (trailing_wide_ints::extra_size): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255862
2017-12-12[IEPM] Introduce debug hook for inline entry point markersAlexandre Oliva1-0/+2
The inline_entry hook will be given a definition in a later patch. for gcc/ChangeLog * debug.h (gcc_debug_hooks): Add inline_entry. * dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Likewise. * debug.c (do_nothing_debug_hooks): Likewise. * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. * dwarf2out.c (dwarf2_debug_hooks): Likewise. (dwarf2_lineno_debug_hooks): Likewise. From-SVN: r255570
2017-12-12[SFN] not-quite-boilerplate changes in preparation to introduce nonbind markersAlexandre Oliva1-2/+36
This patch adjusts numerous parts of the compiler that would malfunction should they find debug markers at points where they may be introduced. The changes purport to allow the compiler to pass bootstrap-debug-lean (-fcompare-debug in stage3) at various optimization levels, as well as bootstrap-debug-lib (-fcompare-debug for target libraries), even after the compiler is changed so that debug markers are introduced in code streams at spots where earlier debug stmts, insns and notes wouldn't normally appear. This patch depends on an earlier SFN boilerplate patch, and on another SFN patch that introduces new RTL insn-walking functions. for gcc/ChangeLog * cfgcleanup.c (delete_unreachable_blocks): Use alternate block removal order if MAY_HAVE_DEBUG_BIND_INSNS. * cfgexpand.c (label_rtx_for_bb): Skip debug insns. * cfgrtl.c (try_redirect_by_replacing_jump): Skip debug insns. (rtl_tidy_fallthru_edge): Likewise. (rtl_verify_fallthru): Likewise. (rtl_verify_bb_layout): Likewise. (skip_insns_after_block): Likewise. (duplicate_insn_chain): Use DEBUG_BIND_INSN_P. * dwarf2out.c: Include print-rtl.h. (dwarf2out_next_real_insn): New. (dwarf2out_var_location): Call it. Disregard begin stmt markers. Dump debug binds in asm comments. * gimple-iterator.c (gimple_find_edge_insert_loc): Skip debug stmts. * gimple-iterator.h (gsi_start_bb_nondebug): Remove; adjust callers to use gsi_start_nondebug_bb instead. (gsi_after_labels): Skip gimple debug stmts. (gsi_start_nondebug): New. * gimple-loop-interchange.c (find_deps_in_bb_for_stmt): Adjust. (proper_loop_form_for_interchange): Adjust. * gimple-low.c (gimple_seq_may_fallthru): Take last nondebug stmt. * gimple.h (gimple_seq_last_nondebug_stmt): New. * gimplify.c (last_stmt_in_scope): Skip debug stmts. (collect_fallthrough_labels): Likewise. (should_warn_for_implicit_fallthrough): Likewise. (warn_implicit_fallthrough_r): Likewise. (expand_FALLTHROUGH_r): Likewise. * graphite-isl-ast-to-gimple.c (gsi_insert_earliest): Adjust. (graphite_copy_stmts_from_block): Skip nonbind markers. * haifa-sched.c (sched_extend_bb): Skip debug insns. * ipa-icf-gimple.c (func_checker::compare_bb): Adjust. * jump.c (clean_barriers): Skip debug insns. * omp-expand.c (expand_parallel_call): Skip debug insns. (expand_task_call): Likewise. (remove_exit_barrier): Likewise. (expand_omp_taskreg): Likewise. (expand_omp_for_init_counts): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_for_static_chunk): Likewise. (expand_omp_simd): Likewise. (expand_omp_taskloop_for_outer): Likewise. (expand_omp_taskloop_for_inner): Likewise. (expand_oacc_for): Likewise. (expand_omp_sections): Likewise. (expand_omp_single): Likewise. (expand_omp_synch): Likewise. (expand_omp_atomic_load): Likewise. (expand_omp_atomic_store): Likewise. (expand_omp_atomic_fetch_op): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (expand_omp_target): Likewise. (grid_expand_omp_for_loop): Likewise. (grid_expand_target_grid_body): Likewise. (build_omp_regions_1): Likewise. * omp-low.c (check_combined_parallel): Skip debug stmts. * postreload.c (fixup_debug_insns): Skip nonbind debug insns. * regcprop.c (find_oldest_value_reg): Ensure REGNO is not a pseudo. * sese.c (sese_trivially_empty_bb_p): Call is_gimple_debug in test. * tree-cfg.c (make_blobs_1): Skip debug stmts. (make_edges): Likewise. (cleanup_dead_labels): Likewise. (gimple_can_merge_blocks_p): Likewise. (stmt_starts_bb_p): Likewise. (gimple_block_label): Likewise. (gimple_redirect_edge_and_branch): Likewise. * tree-cfgcleanup.c (remove_forwarder_block): Rearrange skipping of debug stmts. (execute_cleanup_cfg_post_optimizing): Dump enumerated decls with TDF_SLIM. * tree-pretty-print (print_declaration): Omit initializer in slim dumps. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Mark begin stmt markers. (eliminate_unnecessary_stmts): Stabilize block removal order. * tree-ssa-tail-merge.c (find_duplicate): Skip debug stmts. * var-tracking.c (get_first_insn): New. (vt_emit_notes): Call it. (vt_initialize): Walk any insns before the first BB. (delete_debug_insns): Likewise. From-SVN: r255566
2017-12-08re PR bootstrap/81470 (Bootstrap comparison failures in gcc/ada)Tristan Gingold1-1/+7
2017-06-08 Tristan Gingold <gindold@adacore.com> PR ada/81470 * dwarf2out.c (dwarf2out_do_cfi_startproc): Only emit .cfi_personality or .cfi_lsda if the eh data format is dwarf2. From-SVN: r255501
2017-11-23Fix .debug_rnglists generation with -gdwarf-5 -gsplit-dwarf.Mark Wielaard1-9/+18
Early debug broke generation of .debug_rnglists when using both -gdwarf5 and -gsplit-dwarf. It introduces a generation for init_sections_and_labels, but doesn't account for the generation of up to 4 unique ranges labels, two created in init_sections_and_labels and two in output_rnglists. Fix this by passing generation to output_rnglists and creating 4 unique labels per generation. Without this fix using -gdwarf-5 -gsplit-dwarf could result in: Error: symbol `.Ldebug_ranges2' is already defined gcc/ChangeLog: * dwarf2out.c (init_sections_and_labels): Use generation to create unique ranges_section_label and ranges_base_label. Return generation. (output_rnglists): Add generation argument. Use generation to create unique ranges labels. (dwarf2out_finish): Get generation from init_sections_and_labels and pass generation to output_rnglists. From-SVN: r255107
2017-11-22re PR c++/60336 (empty struct value is passed differently in C and C++)Marek Polacek1-15/+0
PR c++/60336 PR middle-end/67239 PR target/68355 * c-decl.c (grokdeclarator): Set DECL_PADDING_P on unnamed bit-fields. * class.c (layout_class_type): Set DECL_PADDING_P on padding. * decl.c (cxx_init_decl_processing): Set TRANSLATION_UNIT_WARN_EMPTY_P. (grokdeclarator): Set DECL_PADDING_P on unnamed bit-fields. * lto.c (compare_tree_sccs_1): Compare TYPE_EMPTY_P and DECL_PADDING_P. * calls.c (initialize_argument_information): Call warn_parameter_passing_abi target hook. (store_one_arg): Use 0 for empty record size. Don't push 0 size argument onto stack. (must_pass_in_stack_var_size_or_pad): Return false for empty types. * common.opt: Update -fabi-version description. * config/i386/i386.c (init_cumulative_args): Set cum->warn_empty. (ix86_gimplify_va_arg): Call arg_int_size_in_bytes instead of int_size_in_bytes. (ix86_is_empty_record): New function. (ix86_warn_parameter_passing_abi): New function. (TARGET_EMPTY_RECORD_P): Redefine. (TARGET_WARN_PARAMETER_PASSING_ABI): Redefine. * config/i386/i386.h (CUMULATIVE_ARGS): Add warn_empty. * doc/tm.texi: Regenerated. * doc/tm.texi.in (TARGET_EMPTY_RECORD_P, TARGET_WARN_PARAMETER_PASSING_ABI): Add. * dwarf2out.c (get_ultimate_context): Move to tree.c. * explow.c (hard_function_value): Call arg_int_size_in_bytes instead of int_size_in_bytes. * expr.c (copy_blkmode_to_reg): Likewise. * function.c (aggregate_value_p): Return 0 for empty types. (assign_parm_find_entry_rtl): Call warn_parameter_passing_abi target hook. (locate_and_pad_parm): Call arg size_in_bytes instead size_in_bytes. * lto-streamer-out.c (hash_tree): Hash TYPE_EMPTY_P and DECL_PADDING_P. * stor-layout.c (finalize_type_size): Set TYPE_EMPTY_P. * target.def (empty_record_p, warn_parameter_passing_abi): New target hooks. * targhooks.c (hook_void_CUMULATIVE_ARGS_tree): New hook. (std_gimplify_va_arg_expr): Skip empty records. Call arg_size_in_bytes instead size_in_bytes. * targhooks.h (hook_void_CUMULATIVE_ARGS_tree): Declare. * tree-core.h (tree_type_common): Add empty_flag. (tree_decl_common): Update comments. * tree-streamer-in.c (unpack_ts_decl_common_value_fields): Stream DECL_PADDING_P. (unpack_ts_type_common_value_fields): Stream TYPE_EMPTY_P. * tree-streamer-out.c (pack_ts_decl_common_value_fields): Stream DECL_PADDING_P. (pack_ts_type_common_value_fields): Stream TYPE_EMPTY_P. * tree.c (default_is_empty_type): New function. (default_is_empty_record): New function. (arg_int_size_in_bytes): New function. (arg_size_in_bytes): New function. (get_ultimate_context): New function. * tree.h: Define TYPE_EMPTY_P, DECL_PADDING_P and TRANSLATION_UNIT_WARN_EMPTY_P. (default_is_empty_record, arg_int_size_in_bytes, arg_size_in_bytes, get_ultimate_context): Declare. * g++.dg/abi/empty12.C: New test. * g++.dg/abi/empty12.h: New test. * g++.dg/abi/empty12a.c: New test. * g++.dg/abi/empty13.C: New test. * g++.dg/abi/empty13.h: New test. * g++.dg/abi/empty13a.c: New test. * g++.dg/abi/empty14.C: New test. * g++.dg/abi/empty14.h: New test. * g++.dg/abi/empty14a.c: New test. * g++.dg/abi/empty15.C: New test. * g++.dg/abi/empty15.h: New test. * g++.dg/abi/empty15a.c: New test. * g++.dg/abi/empty16.C: New test. * g++.dg/abi/empty16.h: New test. * g++.dg/abi/empty16a.c: New test. * g++.dg/abi/empty17.C: New test. * g++.dg/abi/empty17.h: New test. * g++.dg/abi/empty17a.c: New test. * g++.dg/abi/empty18.C: New test. * g++.dg/abi/empty18.h: New test. * g++.dg/abi/empty18a.c: New test. * g++.dg/abi/empty19.C: New test. * g++.dg/abi/empty19.h: New test. * g++.dg/abi/empty19a.c: New test. * g++.dg/abi/empty20.C: New test. * g++.dg/abi/empty21.C: New test. * g++.dg/abi/empty22.C: New test. * g++.dg/abi/empty22.h: New test. * g++.dg/abi/empty22a.c: New test. * g++.dg/abi/empty23.C: New test. * g++.dg/abi/empty24.C: New test. * g++.dg/abi/empty25.C: New test. * g++.dg/abi/empty25.h: New test. * g++.dg/abi/empty25a.c: New test. * g++.dg/abi/empty26.C: New test. * g++.dg/abi/empty26.h: New test. * g++.dg/abi/empty26a.c: New test. * g++.dg/abi/empty27.C: New test. * g++.dg/abi/empty28.C: New test. * g++.dg/abi/pr60336-1.C: New test. * g++.dg/abi/pr60336-10.C: New test. * g++.dg/abi/pr60336-11.C: New test. * g++.dg/abi/pr60336-12.C: New test. * g++.dg/abi/pr60336-2.C: New test. * g++.dg/abi/pr60336-3.C: New test. * g++.dg/abi/pr60336-4.C: New test. * g++.dg/abi/pr60336-5.C: New test. * g++.dg/abi/pr60336-6.C: New test. * g++.dg/abi/pr60336-7.C: New test. * g++.dg/abi/pr60336-8.C: New test. * g++.dg/abi/pr60336-9.C: New test. * g++.dg/abi/pr68355.C: New test. * g++.dg/lto/pr60336_0.C: New test. Co-Authored-By: H.J. Lu <hongjiu.lu@intel.com> Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r255066
2017-11-22re PR debug/83034 (ice in mem_loc_descriptor, at dwarf2out.c :15669)Jakub Jelinek1-0/+1
PR debug/83034 * dwarf2out.c (mem_loc_descriptor): Handle VEC_SERIES. * gcc.dg/pr83034.c: New test. From-SVN: r255049
2017-11-21re PR debug/82718 (Bad DWARF5 .debug_loclists generation)Jakub Jelinek1-82/+101
PR debug/82718 * dwarf2out.c (dw_loc_list): If crtl->has_bb_partition, temporarily set in_cold_section_p to the partition containing loc_list->first. When seeing loc_list->last_before_switch node, update secname and perform range_across_switch second partition handling only after that. * gcc.dg/debug/dwarf2/pr82718-1.c: New test. * gcc.dg/debug/dwarf2/pr82718-2.c: New test. From-SVN: r254989
2017-11-21re PR debug/82933 (valgrind error in set_cur_line_info_table with -g)Jakub Jelinek1-0/+3
PR debug/82933 * run-rtl-passes.c: Include debug.h. (run_rtl_passes): Call debug_hooks->assembly_start. * dwarf2out.c (dwarf2out_assembly_start): Return early if invoked multiple times. * gcc.dg/rtl/x86_64/pr82933.c: New test. From-SVN: r254987
2017-11-15Use compare-debug for bootstrap-debug-lean to ignore != DW_AT_producerAlexandre Oliva1-0/+1
Unlike bootstrap-debug, bootstrap-debug-lean used to pass compare using the traditional compare command, because it compiled both stage2 and stage3 with options that used to generate identical output (-fcompare-debug= in stage2 vs -fcompare-debug in stage3). Since we started adding relevant command-line flags to DW_AT_producer, this is no longer the case, and stages 2 and 3 object files that differ in nothing but the DW_AT_producer strings. -fcompare-debug is short for -fcompare-debug=-gtoggle, so stage3 compiles twice, once with the normal options, once with toggled -g, to then compare the temporary final dumps. When enabled, both compilations get from the driver an additional -frandom-seed flag (if none is given explicitly). -fcompare-debug= is short for -fno-compare-debug, disabling the second compilation. The difference between the DW_AT_producer lines are the different -fcompare-debug flags, and the presence of the -frandom-seed flag in the stage3 compilation. It is easy and sensible enough to filter the -fcompare-debug flags out of the DW_AT_producer string. This option should never affect the compilation output, it just determines whether or not to perform an additional compilation that should produce the same executable output. However, dropping -frandom-seed is not quite correct, in that it might have other consequences on the compilation. So, it makes little sense to make the effort to drop it when it's implicit; for those comparing compiler output differences, it might even hint at what causes, and could fix, difficult to explain differences, namely, explicitly supplying -frandom-seed options. They don't seem to matter for compiler bootstraps, though, at least for now, so we can safely refrain from issuing -frandom-seed (or maybe we already issue it where needed :-), and then, for bootstrap-debug-lean, use the compare-debug script, that strips out debug information before comparing the object files. for config/ChangeLog * bootstrap-debug-lean.mk (do-compare): Use the contrib/compare-debug script. for gcc/ChangeLog * dwarf2out.c (gen_producer_string): Discard OPT_fcompare_debug. From-SVN: r254750
2017-11-13re PR lto/81351 (Many LTO testcases FAIL)Eric Botcazou1-1/+8
PR lto/81351 * dwarf2out.c (do_eh_frame): New static variable. (dwarf2out_begin_prologue): Set it. (dwarf2out_frame_finish): Test it instead of dwarf2out_do_eh_frame. From-SVN: r254700
2017-11-13re PR lto/81351 (Many LTO testcases FAIL)Eric Botcazou1-6/+3
PR lto/81351 * debug.h (dwarf2out_do_eh_frame): Declare. * dwarf2cfi.c (dwarf2out_do_eh_frame): New predicate. (dwarf2out_do_frame): Use it. (dwarf2out_do_cfi_asm): Likewise. * dwarf2out.c (dwarf2out_frame_finish): Likewise. (dwarf2out_assembly_start): Likewise. (dwarf2out_begin_prologue): Fix comment. * toplev.c (compile_file): Always call dwarf2out_frame_finish if the target needs either debug or unwind DWARF2 info. * lto-opts.c (lto_write_options): Do not save -fexceptions, -fnon-call-exceptions, -ffp-contract, -fmath-errno, -fsigned-zeros, -ftrapping-math, -ftrapv and -fwrapv. From-SVN: r254697
2017-11-09re PR debug/82837 (ICE in output_operand: invalid expression as operand)Jakub Jelinek1-5/+33
PR debug/82837 * dwarf2out.c (const_ok_for_output_1): Reject NEG in addition to NOT. (mem_loc_descriptor): Handle (const (neg (...))) as (neg (const (...))) and similarly for not instead of neg. * gcc.dg/debug/dwarf2/pr82837.c: New test. From-SVN: r254561