summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-niter.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-11-15 13:19:05 -0800
committerH.J. Lu <hjl.tools@gmail.com>2015-11-21 08:31:20 -0800
commit75a3ced21c0725b04d6f06e90ffe53ff57114d35 (patch)
treebea41a6e0a876e3a7b7e7f1cac13d1ae499e4287 /gcc/tree-ssa-loop-niter.c
parent94338ce6dad57e94692154d9287d9dd48ff628f3 (diff)
downloadgcc-75a3ced21c0725b04d6f06e90ffe53ff57114d35.tar.gz
Add LANG_HOOKS_EMPTY_RECORD_P for C++ empty classhjl/pr60336/hook
Empty record should be returned and passed the same way in C and C++. This patch adds LANG_HOOKS_EMPTY_RECORD_P for C++ empty class, which defaults to return false. For C++, LANG_HOOKS_EMPTY_RECORD_P is defined to is_really_empty_class, which returns true for C++ empty classes. For LTO, we stream out a bit to indicate if a record is empty and we store it in TYPE_LANG_FLAG_0 when streaming in. Middle-end and x86 backend are updated to ignore empty records for parameter passing and function value return. Other targets may need similar changes. get_ref_base_and_extent is changed to set bitsize to 0 for empty records so that when ref_maybe_used_by_call_p_1 calls get_ref_base_and_extent to get 0 as the maximum size on empty record. Otherwise, find_tail_calls won't perform tail call optimization for functions with empty record parameters, as shown in g++.dg/pr60336-1.C and g++.dg/pr60336-2.C. gcc/ PR c++/60336 PR middle-end/67239 PR target/68355 * calls.c (initialize_argument_information): Replace targetm.calls.function_arg, targetm.calls.function_incoming_arg and targetm.calls.function_arg_advance with function_arg, function_incoming_arg and function_arg_advance. (expand_call): Likewise. (emit_library_call_value_1): Likewise. (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 record. * dse.c (get_call_args): Replace targetm.calls.function_arg and targetm.calls.function_arg_advance with function_arg and function_arg_advance. * expr.c (block_move_libcall_safe_for_call_parm): Likewise. * function.c (aggregate_value_p): Replace targetm.calls.return_in_memory with return_in_memory. (assign_parm_find_entry_rtl): Replace targetm.calls.function_incoming_arg with function_incoming_arg. (assign_parms): Replace targetm.calls.function_arg_advance with function_arg_advance. (gimplify_parameters): Replace targetm.calls.function_arg_advance with function_arg_advance. (locate_and_pad_parm): Use 0 for empty record size. (function_arg_advance): New wrapper function. (function_arg): Likewise. (function_incoming_arg): Likewise. (return_in_memory): Likewise. * langhooks-def.h (LANG_HOOKS_EMPTY_RECORD_P): New. (LANG_HOOKS_DECLS): Add LANG_HOOKS_EMPTY_RECORD_P. * langhooks.h (lang_hooks_for_decls): Add empty_record_p. * lto-streamer.h (LTO_major_version): Increase by 1 to 6. * target.h (function_arg_advance): New prototype. (function_arg): Likewise. (function_incoming_arg): Likewise. (return_in_memory): Likewise. * targhooks.c: Include "langhooks.h". (std_gimplify_va_arg_expr): Use 0 for empty record size. * tree-dfa.c (get_ref_base_and_extent): Likewise. * tree-streamer-in.c (unpack_ts_base_value_fields): Stream in TYPE_LANG_FLAG_0. * tree-streamer-out.c: Include "langhooks.h". (pack_ts_base_value_fields): Stream out a bit to indicate if a record is empty. * var-tracking.c (prepare_call_arguments): Replace targetm.calls.function_arg and targetm.calls.function_arg_advance with function_arg and function_arg_advance. * config/i386/i386.c (ix86_gimplify_va_arg): Use 0 for empty record size. gcc/cp/ PR c++/60336 PR middle-end/67239 PR target/68355 * class.c (is_empty_class): Changed to return bool and take const_tree. (is_really_empty_class): Changed to take const_tree. Check if TYPE_BINFO is zero. * cp-tree.h (is_empty_class): Updated. (is_really_empty_class): Likewise. * cp-lang.c (LANG_HOOKS_EMPTY_RECORD_P): New. gcc/lto/ PR c++/60336 PR middle-end/67239 PR target/68355 * lto-lang.c (lto_empty_record_p): New. (LANG_HOOKS_EMPTY_RECORD_P): Likewise. gcc/testsuite/ PR c++/60336 PR middle-end/67239 PR target/68355 * g++.dg/abi/empty12.C: New test. * g++.dg/abi/empty12.h: Likewise. * g++.dg/abi/empty12a.c: Likewise. * g++.dg/pr60336-1.C: Likewise. * g++.dg/pr60336-2.C: Likewise. * g++.dg/pr68355.C: Likewise.
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
0 files changed, 0 insertions, 0 deletions