* cfghooks.h (struct cfg_hooks) <account_profile_record>: New hook.
(account_profile_record): New prototype.
* cfghooks.c (account_profile_record): New function.
* tree-cfg.c (gimple_account_profile_record): New function
(gimple_cfg_hooks): Add it.
* cfgrtl.c (rtl_account_profile_record): New function
(rtl_cfg_hooks, cfg_layout_rtl_cfg_hooks): Add it.
* passes.c (check_profile_consistency): Simplify. Move IR-dependent
code around using cfghooks machinery.
From-SVN: r192271
* configure.ac: Check for link.h and dl_iterate_phdr.
* elf.c: #include <link.h> if system has dl_iterate_phdr. #undef
ELF macros before #defining them.
(dl_phdr_info, dl_iterate_phdr): Define if system does not have
dl_iterate_phdr.
(struct elf_syminfo_data): Add next field.
(elf_initialize_syminfo): Initialize next field.
(elf_add_syminfo_data): New static function.
(elf_add): New static function, broken out of
backtrace_initialize. Call backtrace_dwarf_add instead of
backtrace_dwarf_initialize.
(struct phdr_data): Define.
(phdr_callback): New static function.
(backtrace_initialize): Call elf_add.
* dwarf.c (struct dwarf_data): Add next and base_address fields.
(add_unit_addr): Add base_address parameter. Change all callers.
(add_unit_ranges, build_address_map): Likewise.
(add_line): Add ddata parameter. Change all callers.
(read_line_program, add_function_range): Likewise.
(dwarf_lookup_pc): New static function, broken out of
dwarf_fileline.
(dwarf_fileline): Call dwarf_lookup_pc.
(build_dwarf_data): New static function.
(backtrace_dwarf_add): New function.
(backtrace_dwarf_initialize): Remove.
* internal.h (backtrace_dwarf_initialize): Don't declare.
(backtrace_dwarf_add): Declare.
* configure, config.h.in: Rebuild.
From-SVN: r192267
2012-10-09 Richard Guenther <rguenther@suse.de>
PR middle-end/54837
* cfgexpand.c (expand_debug_source_expr): Move checking
code conditional on a found decl_debug_args vector.
From-SVN: r192255
* loop-unroll.c (unroll_loop_constant_iterations): Add
update of loop->nb_iterations_upper_bound I missed in my previous
commit; use TRUNC_DIV_EXPR instead of FLOOR_DIV_EXPR to divide
iteration count.
(decide_unroll_runtime_iterations): Avoid overflow.
(unroll_loop_runtime_iterations): Use TRUNC_DIV_EXPR instead of
FLOOR_DIV_EXPR to update iteration bounds.
(decide_peel_simple): Avoid integer overflow when deciding
on number of peelings.
(decide_unroll_stupid): Likewise.
From-SVN: r192251
* loop-unswitch.c (unswitch_single_loop): Use
estimated_loop_iterations_int to prevent unswitching when loop
is known to not roll.
* tree-ssa-loop-niter.c (estimated_loop_iterations): Do not segfault
when SCEV is not initialized.
(max_loop_iterations): Likewise.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops): Use
estimated_loop_iterations_int to prevent unswithcing when
loop is known to not roll.
* tree-scalar-evolution.c (scev_initialized_p): New function.
* tree-scalar-evolution.h (scev_initialized_p): Likewise.
* loop-unroll.c (decide_peel_once_rolling): Use
max_loop_iterations_int.
(unroll_loop_constant_iterations): Update
nb_iterations_upper_bound and nb_iterations_estimate.
(decide_unroll_runtime_iterations): Use
estimated_loop_iterations or max_loop_iterations;
(unroll_loop_runtime_iterations): fix profile updating.
(decide_peel_simple): Use estimated_loop_iterations
and max_loop_iterations.
(decide_unroll_stupid): Use estimated_loop_iterations
ad max_loop_iterations.
* loop-doloop.c (doloop_modify): Use max_loop_iterations_int.
(doloop_optimize): Likewise.
* loop-iv.c (iv_number_of_iterations): Use record_niter_bound.
(find_simple_exit): Likewise.
* cfgloop.h (struct niter_desc): Remove niter_max.
From-SVN: r192219
* lto/lto.c (remember_with_vars): Also fixup INTEGER_CST.
(fixup_integer_cst): New functoin.
(lto_ft_type): Fixup BASETYPE of methods and offsets.
From-SVN: r192214
* bitmap.h (bitmap_and_into): Update prototype.
* bitmap.c (bitmap_and_into): Return true if the target bitmap
changed, false otherwise.
* df.h (df_dump_insn_problem_function): New function type.
(struct df_problem): Add two functions, to dump just before and
just after an insn.
(DF_RD_PRUNE_DEAD_DEFS): New changable flag.
(df_dump_insn_top, df_dump_insn_bottom): New prototypes.
* df-core (df_dump_region): Use dump_bb.
(df_dump_bb_problem_data): New function.
(df_dump_top, df_dump_bottom): Rewrite using df_dump_bb_problem_data.
(df_dump_insn_problem_data): New function.
(df_dump_insn_top, df_dump_insn_bottom): New functions.
* df-scan.c (problem_SCAN): Add NULL fields for new members.
* df-problems.c (df_rd_local_compute): Ignore hard registers if
DF_NO_HARD_REGS is in effect.
(df_rd_transfer_function): If DF_RD_PRUNE_DEAD_DEFS is in effect,
prune reaching defs using the LR problem.
(df_rd_start_dump): Fix dumping of DEFs map.
(df_rd_dump_defs_set): New function.
(df_rd_top_dump, df_rd_bottom_dump): Use it.
(problem_RD): Add NULL fields for new members.
(problem_LR, problem_LIVE): Likewise.
(df_chain_bb_dump): New function.
(df_chain_top_dump): Dump only for artificial DEFs and USEs,
using df_chain_bb_dump.
(df_chain_bottom_dump): Likewise.
(df_chain_insn_top_dump, df_chain_insn_bottom_dump): New functions.
(problem_CHAIN): Add them as new members.
(problem_WORD_LR, problem_NOTE): Add NULL fields for new members.
(problem_MD): Likewise.
* cfgrtl.c (rtl_dump_bb): Use df_dump_insn_top and df_dump_insn_bottom.
(print_rtl_with_bb): Likewise.
* dce.c (init_dce): Use DF_RD_PRUNE_DEAD_DEFS.
* loop-invariant.c (find_defs): Likewise.
* loop-iv.c (iv_analysis_loop_init): Likewise.
* ree.c (find_and_remove_re): Likewise.
* web.c (web_main): Likewise.
From-SVN: r192213
c-family/
* c-common.c (c_common_reswords): Add thread_local.
cp/
* decl.c (cp_finish_decl): Remove errors about non-trivial
initialization and destruction of TLS variables.
(register_dtor_fn): Add sorry about TLS variables.
(expand_static_init): Add sorry about non-local TLS variables,
or error with __thread.
Don't emit thread-safety guards for local TLS variables.
(grokdeclarator): thread_local in a function implies static.
* decl.h: Adjust prototype.
* decl2.c (get_guard): Copy DECL_TLS_MODEL.
* parser.c (cp_parser_set_storage_class, cp_parser_set_decl_spec_type)
(set_and_check_decl_spec_loc): Take the token rather than the location.
Distinguish between __thread and thread_local.
(cp_parser_set_storage_class): Don't complain about thread_local before
extern/static.
(token_is__thread): New.
* call.c (make_temporary_var_for_ref_to_temp): Handle TLS.
* cp-tree.h (DECL_GNU_TLS_P): New.
(cp_decl_specifier_seq): Add gnu_thread_keyword_p.
From-SVN: r192209
2012-10-08 Richard Guenther <rguenther@suse.de>
* tree-ssa-pre.c (postorder_num): New global.
(compute_antic): Initialize all blocks and adjust for
generic postorder.
(my_rev_post_order_compute): Remove.
(init_pre): Use inverted_post_order_compute.
From-SVN: r192204
* sched-int.h (schedule_block): Adjust declaration.
* sched-rgn.c (bb_state_array, bb_state): New static variables.
(sched_rgn_init): Initialize them.
(sched_rgn_free): Free them.
(schedule_region): Save scheduling state for future blocks, and
pass such state to schedule_block.
* params.def (PARAM_SCHED_STATE_EDGE_PROB_CUTOFF): New.
* doc/invoke.texi (--param): Document it.
* haifa-sched.c (schedule_block): New arg init_state. Use it to
initialize state if nonnull. All callers changed.
Call advance_one_cycle after scheduling.
From-SVN: r192203
PR target/54685
* config/sh/sh.md (one_cmplsi2): Make insn_and_split. Add manual
combine matching for an insn sequence where a ge:SI pattern can be used.
PR target/54685
* gcc.target/sh/pr54685.c: New.
From-SVN: r192200
This patch implements the c++-11 generalized attributes, described in
the N2761 paper[1].
The idea is to modify the front-end to accept the new attribute syntax
(including alignas expressions) and to build an internal
representation similar to the one we already have for GNU attributes.
This lets us re-use our existing GNU attribute mechanisms to support
the generalized c++11 attributes.
The patch does change the existing internal representation to support
scoped attribute (aka attributes with namespaces), which is a concept
that doesn't exist in GNU attributes. I have thus put all existing
GNU extension attributes into the "gnu" namespace. For instance, in
C++-11, the "unused" attribute would be represented as
"[[gnu::unused]]". Because there is no syntax for scoped attributes
in C, writting "__attribute__((unused))" unconditionnally refers to
the "unused" attribute in the "gnu" namespace.
Note that this patch follows a conservative understanding of the
specification by disallowing attributes appertaining to types, unless
they apply to a type definition.
Tested on x86_64-unknown-linux-gnu and powerpc64-unknown-linux-gnu.
[1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf
gcc/
* plugin.h (register_scoped_attributes): Declare new function.
* tree.h (enu attribute_flags::ATTR_FLAG_CXX_11): New flag.
(lookup_scoped_attribute_spec, cxx_11_attribute_p)
(get_attribute_name, get_attribute_namespace): Declare new functions.
(struct attribute_spec): Remove const qualifier from the members.
* tree.c (comp_type_attributes, private_lookup_attribute)
(lookup_ident_attribute, remove_attribute, merge_attribute)
(attribute_hash_list, attribute_list_contained): Use
get_attribute_name.
* attribs.c (decl_attributes): Don't crash on error_mark_node.
Forbid c++11 attributes appertaining to type-specifiers.
(attribute_hash): Remove global variable.
(attributes_table): New global variable.
(find_attribute_namespace, register_scoped_attribute): New static
functions.
(register_scoped_attributes, lookup_scoped_attribute_spec)
(cxx11_attribute_p, get_attribute_name, get_attribute_namespace):
New public functions.
(init_attributes): Register all the GNU attributes into the "gnu"
namespace.
(register_attribute): Use register_scoped_attribute to register
the attribute into the "gnu" namespace.
(lookup_attribute_spec): Use lookup_scoped_attribute_spec to
lookup the attribute in the "gnu" namespace.
(decl_attributes): Use new get_attribute_namespace and
lookup_scoped_attribute_spec to consider attribute namespaces when
looking up attributes. When operating in c++-11 mode, pass flag
ATTR_FLAG_CXX11 to the spec handler.
gcc/c-family/
* c-common.h (bitfield_p, cxx_fundamental_alignment_p): Declare
new functions.
* c-common.c (check_cxx_fundamental_alignment_constraints): New
static function.
(handle_aligned_attribute): In choose strictest alignment
among many. Use new check_cxx_fundamental_alignment_constraints.
(handle_transparent_union_attribute): In c++11 attribute syntax,
don't look through typedefs.
gcc/cp/
* cp-tree.h (enum cpp0x_warn_str::CPP0X_ATTRIBUTES): New member.
(enum cp_decl_spec::ds_std_attribute): New enumerator.
(struct cp_decl_specifier_seq::std_attributes): New field.
(cxx_alignas_expr, warn_misplaced_attr_for_class_type): Declare
new functions.
(check_tag_decl): Take an extra parameter for explicit
instantiations.
* decl.c (warn_misplaced_attr_for_class_type): Extract from ...
(check_tag_decl): ... here. Add check for c++11 attributes being
applied to an explicit instantiation. Take an extra parameter for
explicit instantiations.
(grokdeclarator): Make sure a c++11 attribute after an array
declarator appertains to the array, an attribute after a function
declarator appertains to the function type, an attribute after a
declarator-id appertains to the entity being declared, and an
attribute after a pointer declarator appertains to the pointer.
* decl2.c (is_late_template_attribute): Use get_attribute_name.
* error.c (maybe_warn_cpp0x): Support
CPP0X_GENERALIZED_ATTRIBUTES.
* parser.c (cp_next_tokens_can_be_attribute_p)
(cp_next_tokens_can_be_gnu_attribute_p)
(cp_next_tokens_can_be_std_attribute_p)
(cp_nth_tokens_can_be_attribute_p)
(cp_nth_tokens_can_be_gnu_attribute_p)
(cp_nth_tokens_can_be_std_attribute_p)
(cp_parser_gnu_attribute_list, cp_parser_std_attribute)
(cp_parser_std_attribute_spec, cp_parser_std_attribute_spec_seq)
(cp_parser_attributes_opt, cp_parser_std_attribute_list): New
static functions.
(cp_parser_gnu_attributes_opt): Replace cp_parser_attributes_opt.
(cp_parser_gnu_attribute_list): Replace cp_parser_attribute_list.
(cp_parser_postfix_expression): Disallow "[[" tokens here.
(cp_parser_label_for_labeled_statement): Use take an extra
parameter for attributes.
(cp_parser_block_declaration): Use
cp_nth_tokens_can_be_std_attribute_p here.
(cp_parser_decl_specifier_seq): Likewise. Store C++11 attributes
that appears in in decl specifiers in cp_decl_specifier_seq::std_attributes.
declaration. Emit proper warning about misplaced c++11 attributes
for class type.
(cp_parser_explicit_instantiation): Adjust call to check_tag_decl.
(cp_parser_init_declarator): Parsing attributes here is no more a
GNU extension in c++-11.
(cp_parser_type_specifier_seq): Use
cp_next_tokens_can_be_attribute_p.
(cp_parser_direct_declarator): Likewise. Hang c++11 attributes
following the declarator to its syntactic construct. It'll later
be applied to the proper appertaining entity by grokdeclarator.
(cp_parser_ptr_operator): Likewise.
(make_declarator): Initialize cp_declarator::std_attribute.
(make_pointer_declarator, make_reference_declarator)
(make_ptrmem_declarator, cp_parser_make_indirect_declarator): Take
attributes that appertain to the pointer/reference in argument.
(cp_parser_ptr_operator): Take an out parameter for c++11
attributes. Update comments.
(cp_parser_new_declarator_opt)
(cp_parser_conversion_declarator_opt): Adjust.
(cp_parser_declarator): Likewise. Handle C++11 attributes.
Rename attributes to gnu_attribute for better legibility.
(cp_parser_simple_declaration): Update comment.
(cp_parser_class_specifier_1): Parse GNU attributes specifically
(cp_parser_enum_specifier): Accept only gnu attributes after the
specifier.
(cp_parser_member_declaration): Don't clear attributes -- intended
for the entity being declared -- too early because check_tag_decl
needs them.
(cp_parser_statement): Update comment. Parse optional c++11
attributes at the beginning of the relevant kind of statements and
ignore them, for now, unless when calling
cp_parser_label_for_labeled_statement.
(cp_parser_label_for_labeled_statement): Take c++11 attributes
in parameter.
* semantics.c (potential_constant_expression_1): Likewise.
* typeck.c (fundamental_alignment_p, cxx_alignas_expr): New public
functions.
gcc/testsuite/
* g++.dg/cpp0x/gen-attrs-1.C: New test.
* g++.dg/cpp0x/gen-attrs-2.C: Likewise.
* g++.dg/cpp0x/gen-attrs-2-1.C: Likewise.
* g++.dg/cpp0x/gen-attrs-3.C: Likewise.
* g++.dg/cpp0x/gen-attrs-4.C: Likewise.
* g++.dg/cpp0x/gen-attrs-5.C: Likewise.
* g++.dg/cpp0x/gen-attrs-6.C: Likewise.
* g++.dg/cpp0x/gen-attrs-7.C: Likewise.
* g++.dg/cpp0x/gen-attrs-8.C: Likewise.
* g++.dg/cpp0x/gen-attrs-9.C: Likewise.
* g++.dg/cpp0x/gen-attrs-10.C: Likewise.
* g++.dg/cpp0x/gen-attrs-11.C: Likewise.
* g++.dg/cpp0x/gen-attrs-12.C: Likewise.
* g++.dg/cpp0x/gen-attrs-13.C: Likewise.
* g++.dg/cpp0x/gen-attrs-14.C: Likewise.
* g++.dg/cpp0x/gen-attrs-15.C: Likewise.
* g++.dg/cpp0x/gen-attrs-16.C: Likewise.
* g++.dg/cpp0x/gen-attrs-17.C: Likewise.
* g++.dg/cpp0x/gen-attrs-18.C: Likewise.
* g++.dg/cpp0x/gen-attrs-19.C: Likewise.
* g++.dg/cpp0x/gen-attrs-20.C: Likewise.
* g++.dg/cpp0x/gen-attrs-21.C: Likewise.
* g++.dg/cpp0x/gen-attrs-22.C: Likewise.
* g++.dg/cpp0x/gen-attrs-23.C: Likewise.
* g++.dg/cpp0x/gen-attrs-24.C: Likewise.
* g++.dg/cpp0x/gen-attrs-25.C: Likewise.
* g++.dg/cpp0x/gen-attrs-26.C: Likewise.
* g++.dg/cpp0x/gen-attrs-27.C: Likewise.
* g++.dg/cpp0x/gen-attrs-28.C: Likewise.
* g++.dg/cpp0x/gen-attrs-29.C: Likewise.
* g++.dg/cpp0x/gen-attrs-30.C: Likewise.
* g++.dg/cpp0x/gen-attrs-31.C: Likewise.
* g++.dg/cpp0x/gen-attrs-32.C: Likewise.
* g++.dg/cpp0x/gen-attrs-33.C: Likewise.
* g++.dg/cpp0x/gen-attrs-34.C: Likewise.
* g++.dg/cpp0x/gen-attrs-35.C: Likewise.
* g++.dg/cpp0x/gen-attrs-36.C: Likewise.
* g++.dg/cpp0x/gen-attrs-36-1.C: Likewise.
* g++.dg/cpp0x/gen-attrs-37.C: Likewise.
* g++.dg/cpp0x/gen-attrs-38.C: Likewise.
* g++.dg/cpp0x/gen-attrs-39.C: Likewise.
* g++.dg/cpp0x/gen-attrs-39-1.C: Likewise.
* g++.dg/cpp0x/gen-attrs-40.C: Likewise.
* g++.dg/cpp0x/gen-attrs-41.C: Likewise.
* g++.dg/cpp0x/gen-attrs-42.C: Likewise.
* g++.dg/cpp0x/gen-attrs-43.C: Likewise.
* g++.dg/cpp0x/gen-attrs-44.C: Likewise.
* g++.dg/cpp0x/gen-attrs-45.C: Likewise.
* g++.dg/cpp0x/gen-attrs-46.C: Likewise.
* g++.dg/cpp0x/gen-attrs-47.C: Likewise.
* g++.dg/cpp0x/gen-attrs-47-1.C: Likewise.
* g++.dg/cpp0x/gen-attrs-48.C: Likewise.
* g++.dg/cpp0x/gen-attrs-49.C: Likewise.
* g++.dg/cpp0x/gen-attrs-50.C: Likewise.
* g++.dg/cpp0x/gen-attrs-51.C: Likewise.
* g++.dg/cpp0x/gen-attrs-52.C: Likewise.
* g++.dg/cpp0x/gen-attrs-53.C: Likewise.
From-SVN: r192199