Stack usage support
* common.opt (-fstack-usage): New option.
* doc/invoke.texi (Debugging options): Document it.
* builtins.c (expand_builtin_apply): Pass TRUE as 4th argument to
allocate_dynamic_stack_space.
(expand_builtin_alloca): Add 4th bool parameter CANNOT_ACCUMULATE
and propagate it to allocate_dynamic_stack_space.
(expand_builtin) <BUILT_IN_ALLOCA>: Adjust for above change.
* calls.c (initialize_argument_information): Pass TRUE as 4th
argument to allocate_dynamic_stack_space.
(expand_call): Set current_function_has_unbounded_dynamic_stack_size
to 1 when pushing a variable-sized argument onto the stack. Pass
TRUE as 4th argument to allocate_dynamic_stack_space.
Update current_function_pushed_stack_size.
(emit_library_call_value_1): Likewise.
* explow.c (allocate_dynamic_stack_space): Add 4th bool parameter
CANNOT_ACCUMULATE. If flag_stack_usage, look into the size and
attempt to find an upper bound. Remove redundant code for the
SETJMP_VIA_SAVE_AREA case.
* expr.h (allocate_dynamic_stack_space): Add 4th bool parameter.
* function.h (struct stack_usage): New structure.
(current_function_static_stack_size): New macro.
(current_function_dynamic_stack_size): Likewise.
(current_function_pushed_stack_size): Likewise.
(current_function_dynamic_alloc_count): Likewise.
(current_function_has_unbounded_dynamic_stack_size): Likewise.
(current_function_allocates_dynamic_stack_space): Likewise.
(struct function): Add new field 'su'.
* function.c (instantiate_virtual_regs): If SETJMP_VIA_SAVE_AREA,
add the value of the dynamic offset to the dynamic stack usage.
(gimplify_parameters): Set ALLOCA_FOR_VAR_P on call to BUILT_IN_ALLOCA
for variable-sized objects.
(prepare_function_start): Allocate cfun->su if flag_stack_usage.
(rest_of_handle_thread_prologue_and_epilogue): Call output_stack_usage.
* gimplify.c (gimplify_decl_expr): Set ALLOCA_FOR_VAR_P on call to
BUILT_IN_ALLOCA for variable-sized objects.
* output.h (output_stack_usage): Declare.
* toplev.c (stack_usage_file): New file pointer.
(output_stack_usage): New function.
(open_auxiliary_file): Likewise.
(lang_dependent_init): Open file if flag_stack_usage is set.
(finalize): Close file if stack_usage_file is not null.
* tree.h (ALLOCA_FOR_VAR_P): New macro.
* config/alpha/alpha.c (compute_frame_size): New function.
(alpha_expand_prologue): Use it.
(alpha_start_function): Likewise.
(alpha_expand_epilogue): Likewise. Set stack usage info.
* config/i386/i386.c (ix86_expand_prologue): Likewise.
* config/ia64/ia64.c (ia64_expand_prologue): Likewise.
* config/mips/mips.c (mips_expand_prologue): Likewise.
* config/pa/pa.c (hppa_expand_prologue): Likewise.
* config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise.
* config/sparc/sparc.c (sparc_expand_prologue): Likewise.
testsuite/
* lib/gcc-dg.exp (cleanup-stack-usage): New procedure.
* lib/scanasm.exp (scan-stack-usage): Likewise.
(scan-stack-usage-not): Likewise.
* gcc.dg/stack-usage-1.c: New test.
* gcc.target/i386/stack-usage-realign.c: Likewise.
From-SVN: r163660
PR tree-optimization/45427
* tree-ssa-loop-niter.c (number_of_iterations_ne_max): Rewritten.
Handle the case that the exit is never taken correctly.
(number_of_iterations_ne): Pass exit_must_be_taken to
number_of_iterations_ne_max.
* gcc.dg/tree-ssa/pr45427.c: New test.
From-SVN: r163659
* gcc-interface/trans.c (call_to_gnu): Also force the return slot opt
for the call to a function whose return type was unconstrained.
From-SVN: r163648
* gcc-interface/decl.c (FOREIGN_FORCE_REALIGN_STACK): New macro,
replacement for FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN.
(gnat_to_gnu_entity) <case ..., E_Procedure>: Use it.
From-SVN: r163641
* config/i386/i386.md (zero_extendsidi2_1): Rename from
zero_extendsidi2_32.
(zero_extend<mode>di2): Macroize insn from zero_extend{qi,hi}di2
using SWI12 mode iterator.
(zero_extendhisi2_and): Merge insn pattern and corresponding spliter
to define_insn_and_split pattern.
(zero_extendqi<mode>2): Macroize expander from zero_extendqi{hi,si}2
using SWI24 mode iterator.
(*zero_extendqi<mode>2_and): Macroize insn from
*zero_extendqi{hi,si}2_and using SWI24 mode iterator.
(*zero_extendqi<mode>2_movzbl_and): Macroize insn from
*zero_extendqihi2_movzbw_and and *zero_extendqisi2_movzbl_and using
SWI24 mode iterator.
(*zero_extendqi<mode>2_movzbl): Ditto from
*zero_extendqi{hi,si}2_movzbl.
(extendsidi2_1): Rename from extendsidi2_32.
(extend<mode>di2): Macroize insn from extend{qi,hi}di2 using
SWI12 mode iterator.
From-SVN: r163636
2010-08-29 Janus Weil <janus@gcc.gnu.org>
PR fortran/42769
* resolve.c (resolve_structure_cons): For derived types, make sure the
type has been resolved.
(resolve_typebound_procedures): Make sure the vtab has been generated.
2010-08-29 Janus Weil <janus@gcc.gnu.org>
PR fortran/42769
* gfortran.dg/dynamic_dispatch_11.f03: New.
From-SVN: r163631
* config/ia64/ia64.h (HARD_REGNO_NREGS): Return 1 for CCImode in
general purpose registers.
(HARD_REGNO_MODE_OK): Accept CCImode in general purpose registers.
* config/ia64/ia64.md (*movcci): Change to named pattern. Deal
with general purpose registers and memory operands. Add associated
CCImode post-reload splitter.
* config/ia64/div.md: Change BImode to CCImode throughout.
From-SVN: r163630
* config/i386/sse.md (extsuffix): New code attribute.
(sse4_1_<code>v8qiv8hi2): Macroize insn from sse4_1_extendv8qiv8hi2
and sse4_1_zero_extendv8qiv8hi2 using any_extend code iterator.
(sse4_1_<code>v4qiv4si2): Ditto from sse4_1_extendv4qiv4si2
and sse4_1_zero_extendv4qiv4si2.
(sse4_1_<code>v2qiv2di2): Ditto from sse4_1_extendv2qiv2di2
and sse4_1_zero_extendv2qiv2di2.
(sse4_1_<code>v4hiv4si2): Ditto from sse4_1_extendv4hiv4si2
and sse4_1_zero_extendv4hiv4si2.
(sse4_1_<code>v2hiv2di2): Ditto from sse4_1_extendv2hiv2di2
and sse4_1_zero_extendv2hiv2di2.
(sse4_1_extendv2siv2di2): Ditto from sse4_1_extendv2siv2di2
and sse4_1_zero_extendv2siv2di2
(<s>mulv8hi3_highpart): Macroize expander from {u,s}mulv8hi3_highpart
using any_extend code iterator.
(*avx_<s>mulv8hi3_highpart): Macroize insn from
*avx_{u,s}mulv8hi3_highpart using any_extend code iterator.
(*<s>mulv8hi3_highpart): Ditto from *{u,s}mulv8hi3_highpart.
* config/i386/i386.c (ix86_expand_sse4_unpack): Update for renamed
gen_sse4_1_sign_extend* functions.
(struct builtin_description bdesc_args): Ditto.
From-SVN: r163616
* config/sh/sh.c (push_regs): Emit movml for interrupt handler
when possible.
(sh_expand_epilogue): Likewise.
* config/sh/sh.md (movml_push_banked): New insn.
(movml_pop_banked): Likewise.
* gcc.dg/attr-isr.c: Skip test for -m2a. Don't run on sh2a*-*-*.
Co-Authored-By: Kaz Kojima <kkojima@gcc.gnu.org>
From-SVN: r163602
* genautomata.c (gen_regexp_repeat, gen_regexp_allof,
gen_regexp_oneof, gen_regexp_sequence): Use the string found
in vector element 0 rather than the original string when there's
only one element.
(gen_regexp): Remove extra semicolon.
From-SVN: r163600
PR fortran/32049
* gfortran.h (gfc_real_info): Add c_float128 field.
* mathbuiltins.def: Indicate which builtins are const.
* trans-types.h (float128_type_node, complex_float128_type_node,
gfc_real16_is_float128): New variables.
* trans-types.c (float128_type_node, complex_float128_type_node,
gfc_real16_is_float128): New variables.
(gfc_init_kinds): Allow TFmode.
(gfc_build_real_type): Mark __float128 types as such.
(gfc_init_types): Initialize float128_type_node and
complex_float128_type_node
* f95-lang.c (gfc_init_builtin_functions): Adjust for new
argument of OTHER_BUILTIN macro.
* trans-intrinsic.c (gfc_intrinsic_map_t): Likewise.
(builtin_decl_for_precision): Special case for __float128.
(builtin_decl_for_float_kind): Likewise.
(define_quad_builtin): New function.
(gfc_build_intrinsic_lib_fndecls): Create all __float128
library decls if necessary. Store them in the real16_decl and
complex16_decl builtin map fields.
(gfc_get_intrinsic_lib_fndecl): Handle q-suffixed __float128
library function names.
* gfortran.dg/random_seed_1.f90: Adjust test.
* gfortran.dg/float128_1.f90: New test.
From-SVN: r163597