summaryrefslogtreecommitdiffstats
path: root/gcc/fortran/frontend-passes.c
Commit message (Collapse)AuthorAgeFilesLines
...
* convert each use of gfc_free (p) to free (p)meyering2011-04-181-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do that by running this command: perl -pi -e 's/\bgfc_free ?\(/free (/' \ $(git grep -El '\bgfc_free ?\(') which also corrects the few uses that lacked a space between the function name and the open parenthesis. Manually undo the change to the function definition itself and its prototype. They'll be removed next. * array.c (gfc_free_array_spec, gfc_set_array_spec): s/gfc_free/free/ * constructor.c (node_free): Likewise. * cpp.c (dump_queued_macros): Likewise. * data.c (gfc_assign_data_value): Likewise. * decl.c (free_variable, free_value, gfc_free_data): Likewise. (gfc_free_data_all, match_old_style_init): Likewise. (gfc_set_constant_character_len, gfc_free_enum_history, NUM_DECL): Likewise. (gfc_match_modproc): Likewise. * dependency.c (check_section_vs_section): Likewise. * error.c (gfc_pop_error, gfc_free_error): Likewise. * expr.c (free_expr0, gfc_free_expr, gfc_free_actual_arglist): Likewise. (gfc_free_ref_list, gfc_replace_expr, gfc_copy_ref): Likewise. (find_substring_ref, gfc_simplify_expr, gfc_check_assign_symbol): Likewise. * frontend-passes.c (gfc_run_passes, cfe_expr_0): Likewise. (strip_function_call, optimize_comparison): Likewise. * interface.c (gfc_free_interface, arginfo, check_interface0): Likewise. (CHECK_OS_COMPARISON, gfc_extend_assign, gfc_free_formal_arglist): Likewise. * intrinsic.c (gfc_intrinsic_done_1, gfc_convert_type_warn): Likewise. (gfc_convert_chartype): Likewise. * io.c (gfc_free_open, compare_to_allowed_values, gfc_free_close): Likewise. (gfc_free_filepos, gfc_free_dt, gfc_free_inquire): Likewise. * match.c (gfc_free_iterator, gfc_match_associate): Likewise. (gfc_free_alloc_list, gfc_free_namelist, gfc_free_equiv_until): Likewise. (free_case, gfc_free_forall_iterator): Likewise. * misc.c: Likewise. * module.c (free_pi_tree, resolve_fixups, free_rename): Likewise. (free_true_name, peek_atom, mio_allocated_wide_string): Likewise. (mio_pool_string, mio_internal_string, mio_gmp_integer): Likewise. (mio_gmp_real, mio_expr, mio_typebound_proc): Likewise. (mio_full_typebound_tree, skip_list, load_equiv): Likewise. (free_written_common, gfc_use_module, gfc_free_use_stmts): Likewise. * openmp.c (gfc_free_omp_clauses): Likewise. * options.c (gfc_post_options): Likewise. * parse.c (select_type_pop, parse_omp_structured_block): Likewise. * primary.c (gfc_free_structure_ctor_component): Likewise. * resolve.c (resolve_structure_cons, check_host_association): Likewise. (gfc_resolve_forall, resolve_equivalence): Likewise. * scanner.c (gfc_scanner_done_1, gfc_release_include_path): Likewise. (gfc_define_undef_line, preprocessor_line, include_line): Likewise. (load_file, gfc_read_orig_filename): Likewise. * simplify.c (simplify_transformation_to_array): Likewise. (gfc_simplify_ibits, simplify_shift, gfc_simplify_ishftc, STRING): Likewise. (gfc_simplify_compiler_options): Likewise. * st.c (gfc_free_statement, gfc_free_statements): Likewise. (gfc_free_association_list): Likewise. * symbol.c (free_components, gfc_free_st_label, free_st_labels): Likewise. (gfc_delete_symtree, gfc_free_symbol, gfc_undo_symbols): Likewise. (free_old_symbol, gfc_commit_symbols, free_tb_tree): Likewise. (free_common_tree, free_uop_tree, free_sym_tree): Likewise. (gfc_free_dt_list, gfc_free_equiv_infos, gfc_free_equiv_lists): Likewise. (gfc_free_finalizer, gfc_free_charlen, free_entry_list): Likewise. (gfc_free_namespace): Likewise. * trans-array.c (gfc_free_ss, gfc_trans_array_bound_check): Likewise. (gfc_conv_array_ref, gfc_conv_ss_startstride): Likewise. (gfc_trans_dummy_array_bias, gfc_conv_array_parameter): Likewise. * trans-common.c (get_init_field, create_common): Likewise. * trans-const.c (gfc_build_wide_string_const): Likewise. (gfc_conv_string_init): Likewise. * trans-decl.c (gfc_generate_function_code): Likewise. * trans-expr.c (gfc_conv_substring, gfc_free_interface_mapping): Likewise. (SCALAR_POINTER, gfc_conv_statement_function): Likewise. (gfc_trans_subarray_assign): Likewise. * trans-intrinsic.c (conv_generic_with_optional_char_arg): Likewise. * trans-io.c (gfc_trans_io_runtime_check, set_string): Likewise. (transfer_namelist_element, transfer_array_component): Likewise. * trans-openmp.c (gfc_trans_omp_array_reduction): Likewise. * trans-stmt.c (cleanup_forall_symtrees, gfc_trans_forall_1): Likewise. * trans.c (trans_runtime_error_vararg, gfc_restore_backend_locus): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172666 138bc75d-0d04-0410-961f-82ee72b054a4
* Remove doubled up words.mrs2011-04-101-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172247 138bc75d-0d04-0410-961f-82ee72b054a4
* 2011-04-08 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2011-04-081-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/48448 * gfortran.h (gfc_option_t): Add warn_function_elimination and flag_frontend_optimize. * lang.opt (Wfunction-elimination): Add. (ffrontend-optimize): Add. * invoke.texi: Add documentation for -Wfunction-elimination and -ffrontend-optimize. Add -faggressive-function-elimination to list of code generation options. * frontend-passes.c (gfc_run_passes): Run optimizations if flag_frontend_optimize is set. (warn_function_elimination): New function. (cfe_expr_0): Call it if requested to do so. * options.c (gfc_init_options): Initiate warn_function_elimination and flag_frontend_optimize. (gfc_post_options): Set flag_frontend_optimize if not specified by user, depending on the optimization level. (gfc_handle_option): Handle -Wfunction-elimination and -ffrontend-optimize. 2011-04-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/48448 * gfortran.dg/function_optimize_5.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172215 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-04-04 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2011-04-041-7/+72
| | | | | | | | | | | | | | | * frontend-passes: (optimize_lexical_comparison): New function. (optimize_expr): Call it. (optimize_comparison): Also handle lexical comparison functions. Return false instad of -2 for unequal comparison. 2010-04-04 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.dg/character_comparison_8.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171953 138bc75d-0d04-0410-961f-82ee72b054a4
* 2011-04-04 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2011-04-041-4/+4
| | | | | | | | | | | | | | | PR fortran/48412 * frontend-passes (cfe_expr_0): Reverse the order of going through the loops. 2011-04-04 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/48412 * function_optimize_4.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171952 138bc75d-0d04-0410-961f-82ee72b054a4
* 2011-04-01 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2011-04-011-0/+7
| | | | | | | | | | | | | | | PR fortran/48352 * frontend-passes (cfe_register_funcs): Don't register functions if they appear as iterators in DO loops. 2011-04-01 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/48352 * gfortran.dg/function_optimize_3.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171849 138bc75d-0d04-0410-961f-82ee72b054a4
* 2011-03-29 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2011-03-291-0/+2
| | | | | | | | | | | | | | * gfortran.dg/function_optimize_1.f90: Add -Warray-temporaries, check for corresponding warning. 2011-03-29 Thomas Koenig <tkoenig@gcc.gnu.org> * frontend-passes.c (create_var): Warn about creating an array temporary if requested. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171653 138bc75d-0d04-0410-961f-82ee72b054a4
* 2011-03-27 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2011-03-271-29/+38
| | | | | | | | | | | | | | | | PR fortran/47065 * frontend-passes (optimize_trim): Also follow references, except when they are substring references or array references. 2011-03-27 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/47065 * gfortran.dg/trim_optimize_5.f90: New test. * gfortran.dg/trim_optimize_6.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171575 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-03-21 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2011-03-211-0/+225
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/22572 * gfortran.h (gfc_option_t) : Add flag_aggressive_function_elimination. (gfc_dep_compare_functions): Add prototype. * lang.opt: Add faggressive-function-elimination. * invoke.texi: Document -faggressive-function-elimination. * frontend_passes (expr_array): New static variable. (expr_size): Likewise. (expr_count): Likewise. (current_code): Likewise. (current_ns): Likewise. (gfc_run_passes): Allocate and free space for expressions. (cfe_register_funcs): New function. (create_var): New function. (cfc_expr_0): New function. (cfe_code): New function. (optimize_namespace): Invoke gfc_code_walker with cfe_code and cfe_expr_0. * dependency.c (gfc_dep_compare_functions): New function. (gfc_dep_compare_expr): Use it. * options.c (gfc_init_options): Handle flag_aggressive_function_elimination. (gfc_handle_option): Likewise. 2010-03-21 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/22572 * gfortran.dg/function_optimize_1.f90: New test. * gfortran.dg/function_optimize_2.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171207 138bc75d-0d04-0410-961f-82ee72b054a4
* 2011-01-13 Tobias Burnus <burnus@net-b.de>burnus2011-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mikael Morin <mikael@gcc.gnu.org> PR fortran/45848 PR fortran/47204 * gfortran.h (gfc_code): Move union ext's case_list into the struct block. * dump-parse-tree.c (show_code_node): Adapt by prefixing * case_list by "block.". * frontend-passes.c (gfc_code_walker): Ditto. * match.c (gfc_match_goto, gfc_match_call, gfc_match_case, gfc_match_type_is, gfc_match_class_is): Ditto. * resolve.c (resolve_select, resolve_select_type): Ditto. * st.c (gfc_free_statement): Ditto. * trans-stmt.c (gfc_trans_integer_select, * gfc_trans_logical_select, gfc_trans_character_select): Ditto. * parse.c (resolve_all_program_units): For error recovery, avoid segfault is proc_name is NULL. 2011-01-13 Tobias Burnus <burnus@net-b.de> Mikael Morin <mikael@gcc.gnu.org> PR fortran/45848 PR fortran/47204 * gfortran.dg/select_type_20.f90: New. * gfortran.dg/select_type_21.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168753 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-12-31 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-12-311-1/+104
| | | | | | | | | | | | | | | | | | | | PR fortran/47065 * frontend-passes.c (count_arglist): Static variable to count the nesting of argument lists. (optimize_code): Set count_arglist to 1 if within a call statement, to 0 otherwise. (optimize_trim): New function. (optimize_expr): Adjust count_arglist. Call optimize_trim. 2010-12-31 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/47065 * gfortran.dg/trim_optimize_3.f90: New test. * gfortran.dg/trim_optimize_4.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168367 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-12-29 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-12-291-0/+26
| | | | | | | | | | | | | | * frontend-passes.c (gfc_code_walker): Handle expressions in EXEC_CALL, EXEC_ASSIGN_CALL and EXEC_CALL_PPC. Separate cases in switch statements by blank lines. 2010-12-29 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.dg/character_comparison_7.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@168320 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-10-30 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-10-301-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gfortran.h (gfc_option_t): Replace dump_parse_tree by dump_fortran_original and add dump_fortran_optimized. * lang.opt: Add fdump-fortran-original and fdump-fortran-optimized. Document that fdump-parse-tree is deprecated. * gfortran.texi: Add -fdump-fortran-original and -fdump-fortran-optimized. -fdump-parse-tree is deprecated. * frontend-passes.c (gfc_run_passes): If optimizing and if gfc_option.dump_fortran_optimized is set, dump the parse tree after optimization. * parse.c: Rename gfc_option.dump_parse_tree to gfc_option.dump_fortran_original. * options.c (gfc_init_options): Rename gfc_option.dump_parse_tree to gfc_option.dump_fortran_original and handle gfc_option.dump_fortran_optimize. (gfc_post_options): Rename gfc_option.dump_parse_tree to gfc_option.dump_fortran_original. (gfc_handle_option): Rename OPT_fdump_parse_tree to OPT_fdump_fortran_original and gfc_option.dump_parse_tree to gfc_option.dump_fortran_original. Handle OPT_fdump_fortran_optimized. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166091 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-10-09 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-10-101-20/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | * frontend-passes.c: Include opts.h. (optimize_comparison): Renamed from optimize_equality. Change second argument to operation to be compared. Use flag_finite_math_only to avoid comparing REAL and COMPLEX only when NANs are honored. Simplify comparing of string concatenations where left or right operands are equal. Simplify all comparison operations, based on the result of gfc_dep_compare_expr. * dependency.c: Include arith.h. (gfc_are_identical_variables): Volatile variables should not compare equal to themselves. (gfc_dep_compare_expr): Handle string constants and string concatenations. 2010-10-09 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.dg/character_comparison_4.f90: New test. * gfortran.dg/character_comparison_5.f90: New test. * gfortran.dg/character_comparison_6.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165248 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-09-23 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-09-231-2/+7
| | | | | | | | | | | | | | | | PR fortran/45744 * frontend-passes.c (optimize_binop_array_assignment): Only re-use lhs as intermediate storage if kind and type parameters match. 2010-09-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/45744 * gfortran.dg/dependency_36.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164570 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-09-19 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-09-181-0/+1
| | | | | | | | | * frontend-passes.c (gfc_expr_walker): Also handle EXPR_SUBSTRING. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164404 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-09-17 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-09-181-0/+58
| | | | | | | | | * frontend-passes.c (gfc_expr_walker): Handle constructors and references. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164403 138bc75d-0d04-0410-961f-82ee72b054a4
* * gfortran.h (walk_code_fn_t, walk_expr_fn_t): New types.jakub2010-09-161-251/+266
| | | | | | | | | | | | | | (gfc_expr_walker, gfc_code_walker): New prototypes. * frontend-passes.c (gfc_expr_walker, gfc_code_walker): New functions. (WALK_SUBEXPR, WALK_SUBEXPR_TAIL, WALK_SUBCODE): Define. (optimize_namespace): Use gfc_code_walker. (optimize_code, optimize_expr): Rewritten as gfc_code_walker hooks. (optimize_expr_0, optimize_code_node, optimize_actual_arglist): Removed. (optimize_assignment): Don't call optimize_expr_0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164342 138bc75d-0d04-0410-961f-82ee72b054a4
* * frontend-passes.c (optimize_code_node): Walk block chain by default.jakub2010-09-081-1/+5
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164014 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-09-06 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-09-061-0/+78
| | | | | | | | | | | | | | | | PR fortran/36931 * frontend-passes.c (optimize_binop_array_assignment): New function. (optimize_assignment): Call it. 2010-09-06 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/36931 * gfortran.dg/dependency_35.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163934 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-09-03 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-09-031-2/+14
| | | | | | | | | | | | | | * dump_parse_tree (gfc_run_passes): Call optimize_namespace instead of optimize_code. (optimize_namespace): New function. 2010-09-03 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.dg/trim_optimize_2.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163846 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-08-23 Mikael Morin <mikael@gcc.gnu.org>mikael2010-08-231-0/+7
| | | | | | | | | PR fortran/45380 * frontend-passes.c (optimize_equality): Don't optimize array equality git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163484 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-08-02 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-08-021-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/36854 * dependency.h: Add prototype for gfc_are_identical_variables. * frontend-passes.c: Include depencency.h. (optimimize_equality): Use gfc_are_identical_variables. * dependency.c (identical_array_ref): New function. (gfc_are_identical_variables): New function. (gfc_deb_compare_expr): Use gfc_are_identical_variables. * dependency.c (gfc_check_section_vs_section). Rename gfc_ prefix from statc function. (check_section_vs_section): Change arguments to gfc_array_ref, adjust function body accordingly. 2010-08-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/36854 * gfortran.dg/character_comparison_2.f90: New test. * gfortran.dg/character_comparison_3.f90: New test. * gfortran.dg/dependency_28.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162824 138bc75d-0d04-0410-961f-82ee72b054a4
* 2010-07-25 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2010-07-251-0/+435
PR fortran/40628 * Make-lang.in: Add fortran/frontend-passes.o. * gfortran.h: Add prototype for gfc_run_passes. * resolve.c (gfc_resolve): Call gfc_run_passes. * frontend-passes.c: New file. 2010-07-25 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/40628 * trim_optimize_1.f90: New test. * character_comparision_1.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162519 138bc75d-0d04-0410-961f-82ee72b054a4
OpenPOWER on IntegriCloud